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 = 72);
|
86 | })
|
87 |
|
88 | ({
|
89 |
|
90 | 0:
|
91 | (function(module, __webpack_exports__, __webpack_require__) {
|
92 |
|
93 | "use strict";
|
94 | __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | function normalizeComponent (
|
102 | scriptExports,
|
103 | render,
|
104 | staticRenderFns,
|
105 | functionalTemplate,
|
106 | injectStyles,
|
107 | scopeId,
|
108 | moduleIdentifier, /* server only */
|
109 | shadowMode /* vue-cli only */
|
110 | ) {
|
111 |
|
112 | var options = typeof scriptExports === 'function'
|
113 | ? scriptExports.options
|
114 | : scriptExports
|
115 |
|
116 |
|
117 | if (render) {
|
118 | options.render = render
|
119 | options.staticRenderFns = staticRenderFns
|
120 | options._compiled = true
|
121 | }
|
122 |
|
123 |
|
124 | if (functionalTemplate) {
|
125 | options.functional = true
|
126 | }
|
127 |
|
128 |
|
129 | if (scopeId) {
|
130 | options._scopeId = 'data-v-' + scopeId
|
131 | }
|
132 |
|
133 | var hook
|
134 | if (moduleIdentifier) {
|
135 | hook = function (context) {
|
136 |
|
137 | context =
|
138 | context ||
|
139 | (this.$vnode && this.$vnode.ssrContext) ||
|
140 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
141 |
|
142 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
143 | context = __VUE_SSR_CONTEXT__
|
144 | }
|
145 |
|
146 | if (injectStyles) {
|
147 | injectStyles.call(this, context)
|
148 | }
|
149 |
|
150 | if (context && context._registeredComponents) {
|
151 | context._registeredComponents.add(moduleIdentifier)
|
152 | }
|
153 | }
|
154 |
|
155 |
|
156 | options._ssrRegister = hook
|
157 | } else if (injectStyles) {
|
158 | hook = shadowMode
|
159 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
|
160 | : injectStyles
|
161 | }
|
162 |
|
163 | if (hook) {
|
164 | if (options.functional) {
|
165 |
|
166 |
|
167 | options._injectStyles = hook
|
168 |
|
169 | var originalRender = options.render
|
170 | options.render = function renderWithStyleInjection (h, context) {
|
171 | hook.call(context)
|
172 | return originalRender(h, context)
|
173 | }
|
174 | } else {
|
175 |
|
176 | var existing = options.beforeCreate
|
177 | options.beforeCreate = existing
|
178 | ? [].concat(existing, hook)
|
179 | : [hook]
|
180 | }
|
181 | }
|
182 |
|
183 | return {
|
184 | exports: scriptExports,
|
185 | options: options
|
186 | }
|
187 | }
|
188 |
|
189 |
|
190 | }),
|
191 |
|
192 | 10:
|
193 | (function(module, exports) {
|
194 |
|
195 | module.exports = require("element-ui/lib/input");
|
196 |
|
197 | }),
|
198 |
|
199 | 3:
|
200 | (function(module, exports) {
|
201 |
|
202 | module.exports = require("element-ui/lib/utils/util");
|
203 |
|
204 | }),
|
205 |
|
206 | 44:
|
207 | (function(module, exports) {
|
208 |
|
209 | module.exports = require("element-ui/lib/select");
|
210 |
|
211 | }),
|
212 |
|
213 | 45:
|
214 | (function(module, exports) {
|
215 |
|
216 | module.exports = require("element-ui/lib/option");
|
217 |
|
218 | }),
|
219 |
|
220 | 6:
|
221 | (function(module, exports) {
|
222 |
|
223 | module.exports = require("element-ui/lib/mixins/locale");
|
224 |
|
225 | }),
|
226 |
|
227 | 72:
|
228 | (function(module, __webpack_exports__, __webpack_require__) {
|
229 |
|
230 | "use strict";
|
231 | __webpack_require__.r(__webpack_exports__);
|
232 |
|
233 |
|
234 | var render = function() {
|
235 | var _vm = this
|
236 | var _h = _vm.$createElement
|
237 | var _c = _vm._self._c || _h
|
238 | return _c(
|
239 | "ul",
|
240 | { staticClass: "el-pager", on: { click: _vm.onPagerClick } },
|
241 | [
|
242 | _vm.pageCount > 0
|
243 | ? _c(
|
244 | "li",
|
245 | {
|
246 | staticClass: "number",
|
247 | class: { active: _vm.currentPage === 1, disabled: _vm.disabled }
|
248 | },
|
249 | [_vm._v("1")]
|
250 | )
|
251 | : _vm._e(),
|
252 | _vm.showPrevMore
|
253 | ? _c("li", {
|
254 | staticClass: "el-icon more btn-quickprev",
|
255 | class: [_vm.quickprevIconClass, { disabled: _vm.disabled }],
|
256 | on: {
|
257 | mouseenter: function($event) {
|
258 | _vm.onMouseenter("left")
|
259 | },
|
260 | mouseleave: function($event) {
|
261 | _vm.quickprevIconClass = "el-icon-more"
|
262 | }
|
263 | }
|
264 | })
|
265 | : _vm._e(),
|
266 | _vm._l(_vm.pagers, function(pager) {
|
267 | return _c(
|
268 | "li",
|
269 | {
|
270 | key: pager,
|
271 | staticClass: "number",
|
272 | class: { active: _vm.currentPage === pager, disabled: _vm.disabled }
|
273 | },
|
274 | [_vm._v(_vm._s(pager))]
|
275 | )
|
276 | }),
|
277 | _vm.showNextMore
|
278 | ? _c("li", {
|
279 | staticClass: "el-icon more btn-quicknext",
|
280 | class: [_vm.quicknextIconClass, { disabled: _vm.disabled }],
|
281 | on: {
|
282 | mouseenter: function($event) {
|
283 | _vm.onMouseenter("right")
|
284 | },
|
285 | mouseleave: function($event) {
|
286 | _vm.quicknextIconClass = "el-icon-more"
|
287 | }
|
288 | }
|
289 | })
|
290 | : _vm._e(),
|
291 | _vm.pageCount > 1
|
292 | ? _c(
|
293 | "li",
|
294 | {
|
295 | staticClass: "number",
|
296 | class: {
|
297 | active: _vm.currentPage === _vm.pageCount,
|
298 | disabled: _vm.disabled
|
299 | }
|
300 | },
|
301 | [_vm._v(_vm._s(_vm.pageCount))]
|
302 | )
|
303 | : _vm._e()
|
304 | ],
|
305 | 2
|
306 | )
|
307 | }
|
308 | var staticRenderFns = []
|
309 | render._withStripped = true
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 | var pagervue_type_script_lang_js_ = ({
|
349 | name: 'ElPager',
|
350 |
|
351 | props: {
|
352 | currentPage: Number,
|
353 |
|
354 | pageCount: Number,
|
355 |
|
356 | pagerCount: Number,
|
357 |
|
358 | disabled: Boolean
|
359 | },
|
360 |
|
361 | watch: {
|
362 | showPrevMore: function showPrevMore(val) {
|
363 | if (!val) this.quickprevIconClass = 'el-icon-more';
|
364 | },
|
365 | showNextMore: function showNextMore(val) {
|
366 | if (!val) this.quicknextIconClass = 'el-icon-more';
|
367 | }
|
368 | },
|
369 |
|
370 | methods: {
|
371 | onPagerClick: function onPagerClick(event) {
|
372 | var target = event.target;
|
373 | if (target.tagName === 'UL' || this.disabled) {
|
374 | return;
|
375 | }
|
376 |
|
377 | var newPage = Number(event.target.textContent);
|
378 | var pageCount = this.pageCount;
|
379 | var currentPage = this.currentPage;
|
380 | var pagerCountOffset = this.pagerCount - 2;
|
381 |
|
382 | if (target.className.indexOf('more') !== -1) {
|
383 | if (target.className.indexOf('quickprev') !== -1) {
|
384 | newPage = currentPage - pagerCountOffset;
|
385 | } else if (target.className.indexOf('quicknext') !== -1) {
|
386 | newPage = currentPage + pagerCountOffset;
|
387 | }
|
388 | }
|
389 |
|
390 |
|
391 | if (!isNaN(newPage)) {
|
392 | if (newPage < 1) {
|
393 | newPage = 1;
|
394 | }
|
395 |
|
396 | if (newPage > pageCount) {
|
397 | newPage = pageCount;
|
398 | }
|
399 | }
|
400 |
|
401 | if (newPage !== currentPage) {
|
402 | this.$emit('change', newPage);
|
403 | }
|
404 | },
|
405 | onMouseenter: function onMouseenter(direction) {
|
406 | if (this.disabled) return;
|
407 | if (direction === 'left') {
|
408 | this.quickprevIconClass = 'el-icon-d-arrow-left';
|
409 | } else {
|
410 | this.quicknextIconClass = 'el-icon-d-arrow-right';
|
411 | }
|
412 | }
|
413 | },
|
414 |
|
415 | computed: {
|
416 | pagers: function pagers() {
|
417 | var pagerCount = this.pagerCount;
|
418 | var halfPagerCount = (pagerCount - 1) / 2;
|
419 |
|
420 | var currentPage = Number(this.currentPage);
|
421 | var pageCount = Number(this.pageCount);
|
422 |
|
423 | var showPrevMore = false;
|
424 | var showNextMore = false;
|
425 |
|
426 | if (pageCount > pagerCount) {
|
427 | if (currentPage > pagerCount - halfPagerCount) {
|
428 | showPrevMore = true;
|
429 | }
|
430 |
|
431 | if (currentPage < pageCount - halfPagerCount) {
|
432 | showNextMore = true;
|
433 | }
|
434 | }
|
435 |
|
436 | var array = [];
|
437 |
|
438 | if (showPrevMore && !showNextMore) {
|
439 | var startPage = pageCount - (pagerCount - 2);
|
440 | for (var i = startPage; i < pageCount; i++) {
|
441 | array.push(i);
|
442 | }
|
443 | } else if (!showPrevMore && showNextMore) {
|
444 | for (var _i = 2; _i < pagerCount; _i++) {
|
445 | array.push(_i);
|
446 | }
|
447 | } else if (showPrevMore && showNextMore) {
|
448 | var offset = Math.floor(pagerCount / 2) - 1;
|
449 | for (var _i2 = currentPage - offset; _i2 <= currentPage + offset; _i2++) {
|
450 | array.push(_i2);
|
451 | }
|
452 | } else {
|
453 | for (var _i3 = 2; _i3 < pageCount; _i3++) {
|
454 | array.push(_i3);
|
455 | }
|
456 | }
|
457 |
|
458 | this.showPrevMore = showPrevMore;
|
459 | this.showNextMore = showNextMore;
|
460 |
|
461 | return array;
|
462 | }
|
463 | },
|
464 |
|
465 | data: function data() {
|
466 | return {
|
467 | current: null,
|
468 | showPrevMore: false,
|
469 | showNextMore: false,
|
470 | quicknextIconClass: 'el-icon-more',
|
471 | quickprevIconClass: 'el-icon-more'
|
472 | };
|
473 | }
|
474 | });
|
475 |
|
476 | var src_pagervue_type_script_lang_js_ = (pagervue_type_script_lang_js_);
|
477 |
|
478 | var componentNormalizer = __webpack_require__(0);
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 | var component = Object(componentNormalizer["a" ])(
|
489 | src_pagervue_type_script_lang_js_,
|
490 | render,
|
491 | staticRenderFns,
|
492 | false,
|
493 | null,
|
494 | null,
|
495 | null
|
496 |
|
497 | )
|
498 |
|
499 |
|
500 | if (false) { var api; }
|
501 | component.options.__file = "packages/pagination/src/pager.vue"
|
502 | var pager = (component.exports);
|
503 |
|
504 | var select_ = __webpack_require__(44);
|
505 | var select_default = __webpack_require__.n(select_);
|
506 |
|
507 |
|
508 | var option_ = __webpack_require__(45);
|
509 | var option_default = __webpack_require__.n(option_);
|
510 |
|
511 |
|
512 | var input_ = __webpack_require__(10);
|
513 | var input_default = __webpack_require__.n(input_);
|
514 |
|
515 |
|
516 | var locale_ = __webpack_require__(6);
|
517 | var locale_default = __webpack_require__.n(locale_);
|
518 |
|
519 |
|
520 | var util_ = __webpack_require__(3);
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 | var pagination = ({
|
531 | name: 'ElPagination',
|
532 |
|
533 | props: {
|
534 | pageSize: {
|
535 | type: Number,
|
536 | default: 10
|
537 | },
|
538 |
|
539 | small: Boolean,
|
540 |
|
541 | total: Number,
|
542 |
|
543 | pageCount: Number,
|
544 |
|
545 | pagerCount: {
|
546 | type: Number,
|
547 | validator: function validator(value) {
|
548 | return (value | 0) === value && value > 4 && value < 22 && value % 2 === 1;
|
549 | },
|
550 |
|
551 | default: 7
|
552 | },
|
553 |
|
554 | currentPage: {
|
555 | type: Number,
|
556 | default: 1
|
557 | },
|
558 |
|
559 | layout: {
|
560 | default: 'prev, pager, next, jumper, ->, total'
|
561 | },
|
562 |
|
563 | pageSizes: {
|
564 | type: Array,
|
565 | default: function _default() {
|
566 | return [10, 20, 30, 40, 50, 100];
|
567 | }
|
568 | },
|
569 |
|
570 | popperClass: String,
|
571 |
|
572 | prevText: String,
|
573 |
|
574 | nextText: String,
|
575 |
|
576 | background: Boolean,
|
577 |
|
578 | disabled: Boolean,
|
579 |
|
580 | hideOnSinglePage: Boolean
|
581 | },
|
582 |
|
583 | data: function data() {
|
584 | return {
|
585 | internalCurrentPage: 1,
|
586 | internalPageSize: 0,
|
587 | lastEmittedPage: -1,
|
588 | userChangePageSize: false
|
589 | };
|
590 | },
|
591 | render: function render(h) {
|
592 | var layout = this.layout;
|
593 | if (!layout) return null;
|
594 | if (this.hideOnSinglePage && (!this.internalPageCount || this.internalPageCount === 1)) return null;
|
595 |
|
596 | var template = h('div', { 'class': ['el-pagination', {
|
597 | 'is-background': this.background,
|
598 | 'el-pagination--small': this.small
|
599 | }] });
|
600 | var TEMPLATE_MAP = {
|
601 | prev: h('prev'),
|
602 | jumper: h('jumper'),
|
603 | pager: h('pager', {
|
604 | attrs: { currentPage: this.internalCurrentPage, pageCount: this.internalPageCount, pagerCount: this.pagerCount, disabled: this.disabled },
|
605 | on: {
|
606 | 'change': this.handleCurrentChange
|
607 | }
|
608 | }),
|
609 | next: h('next'),
|
610 | sizes: h('sizes', {
|
611 | attrs: { pageSizes: this.pageSizes }
|
612 | }),
|
613 | slot: h('slot', [this.$slots.default ? this.$slots.default : '']),
|
614 | total: h('total')
|
615 | };
|
616 | var components = layout.split(',').map(function (item) {
|
617 | return item.trim();
|
618 | });
|
619 | var rightWrapper = h('div', { 'class': 'el-pagination__rightwrapper' });
|
620 | var haveRightWrapper = false;
|
621 |
|
622 | template.children = template.children || [];
|
623 | rightWrapper.children = rightWrapper.children || [];
|
624 | components.forEach(function (compo) {
|
625 | if (compo === '->') {
|
626 | haveRightWrapper = true;
|
627 | return;
|
628 | }
|
629 |
|
630 | if (!haveRightWrapper) {
|
631 | template.children.push(TEMPLATE_MAP[compo]);
|
632 | } else {
|
633 | rightWrapper.children.push(TEMPLATE_MAP[compo]);
|
634 | }
|
635 | });
|
636 |
|
637 | if (haveRightWrapper) {
|
638 | template.children.unshift(rightWrapper);
|
639 | }
|
640 |
|
641 | return template;
|
642 | },
|
643 |
|
644 |
|
645 | components: {
|
646 | Prev: {
|
647 | render: function render(h) {
|
648 | return h(
|
649 | 'button',
|
650 | {
|
651 | attrs: {
|
652 | type: 'button',
|
653 |
|
654 | disabled: this.$parent.disabled || this.$parent.internalCurrentPage <= 1
|
655 | },
|
656 | 'class': 'btn-prev', on: {
|
657 | 'click': this.$parent.prev
|
658 | }
|
659 | },
|
660 | [this.$parent.prevText ? h('span', [this.$parent.prevText]) : h('i', { 'class': 'el-icon el-icon-arrow-left' })]
|
661 | );
|
662 | }
|
663 | },
|
664 |
|
665 | Next: {
|
666 | render: function render(h) {
|
667 | return h(
|
668 | 'button',
|
669 | {
|
670 | attrs: {
|
671 | type: 'button',
|
672 |
|
673 | disabled: this.$parent.disabled || this.$parent.internalCurrentPage === this.$parent.internalPageCount || this.$parent.internalPageCount === 0
|
674 | },
|
675 | 'class': 'btn-next', on: {
|
676 | 'click': this.$parent.next
|
677 | }
|
678 | },
|
679 | [this.$parent.nextText ? h('span', [this.$parent.nextText]) : h('i', { 'class': 'el-icon el-icon-arrow-right' })]
|
680 | );
|
681 | }
|
682 | },
|
683 |
|
684 | Sizes: {
|
685 | mixins: [locale_default.a],
|
686 |
|
687 | props: {
|
688 | pageSizes: Array
|
689 | },
|
690 |
|
691 | watch: {
|
692 | pageSizes: {
|
693 | immediate: true,
|
694 | handler: function handler(newVal, oldVal) {
|
695 | if (Object(util_["valueEquals"])(newVal, oldVal)) return;
|
696 | if (Array.isArray(newVal)) {
|
697 | this.$parent.internalPageSize = newVal.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.pageSizes[0];
|
698 | }
|
699 | }
|
700 | }
|
701 | },
|
702 |
|
703 | render: function render(h) {
|
704 | var _this = this;
|
705 |
|
706 | return h(
|
707 | 'span',
|
708 | { 'class': 'el-pagination__sizes' },
|
709 | [h(
|
710 | 'el-select',
|
711 | {
|
712 | attrs: {
|
713 | value: this.$parent.internalPageSize,
|
714 | popperClass: this.$parent.popperClass || '',
|
715 | size: 'mini',
|
716 |
|
717 | disabled: this.$parent.disabled },
|
718 | on: {
|
719 | 'input': this.handleChange
|
720 | }
|
721 | },
|
722 | [this.pageSizes.map(function (item) {
|
723 | return h('el-option', {
|
724 | attrs: {
|
725 | value: item,
|
726 | label: item + _this.t('el.pagination.pagesize') }
|
727 | });
|
728 | })]
|
729 | )]
|
730 | );
|
731 | },
|
732 |
|
733 |
|
734 | components: {
|
735 | ElSelect: select_default.a,
|
736 | ElOption: option_default.a
|
737 | },
|
738 |
|
739 | methods: {
|
740 | handleChange: function handleChange(val) {
|
741 | if (val !== this.$parent.internalPageSize) {
|
742 | this.$parent.internalPageSize = val = parseInt(val, 10);
|
743 | this.$parent.userChangePageSize = true;
|
744 | this.$parent.$emit('update:pageSize', val);
|
745 | this.$parent.$emit('size-change', val);
|
746 | }
|
747 | }
|
748 | }
|
749 | },
|
750 |
|
751 | Jumper: {
|
752 | mixins: [locale_default.a],
|
753 |
|
754 | components: { ElInput: input_default.a },
|
755 |
|
756 | data: function data() {
|
757 | return {
|
758 | userInput: null
|
759 | };
|
760 | },
|
761 |
|
762 |
|
763 | watch: {
|
764 | '$parent.internalCurrentPage': function $parentInternalCurrentPage() {
|
765 | this.userInput = null;
|
766 | }
|
767 | },
|
768 |
|
769 | methods: {
|
770 | handleKeyup: function handleKeyup(_ref) {
|
771 | var keyCode = _ref.keyCode,
|
772 | target = _ref.target;
|
773 |
|
774 |
|
775 |
|
776 |
|
777 | if (keyCode === 13) {
|
778 | this.handleChange(target.value);
|
779 | }
|
780 | },
|
781 | handleInput: function handleInput(value) {
|
782 | this.userInput = value;
|
783 | },
|
784 | handleChange: function handleChange(value) {
|
785 | this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(value);
|
786 | this.$parent.emitChange();
|
787 | this.userInput = null;
|
788 | }
|
789 | },
|
790 |
|
791 | render: function render(h) {
|
792 | return h(
|
793 | 'span',
|
794 | { 'class': 'el-pagination__jump' },
|
795 | [this.t('el.pagination.goto'), h('el-input', {
|
796 | 'class': 'el-pagination__editor is-in-pagination',
|
797 | attrs: { min: 1,
|
798 | max: this.$parent.internalPageCount,
|
799 | value: this.userInput !== null ? this.userInput : this.$parent.internalCurrentPage,
|
800 | type: 'number',
|
801 | disabled: this.$parent.disabled
|
802 | },
|
803 | nativeOn: {
|
804 | 'keyup': this.handleKeyup
|
805 | },
|
806 | on: {
|
807 | 'input': this.handleInput,
|
808 | 'change': this.handleChange
|
809 | }
|
810 | }), this.t('el.pagination.pageClassifier')]
|
811 | );
|
812 | }
|
813 | },
|
814 |
|
815 | Total: {
|
816 | mixins: [locale_default.a],
|
817 |
|
818 | render: function render(h) {
|
819 | return typeof this.$parent.total === 'number' ? h(
|
820 | 'span',
|
821 | { 'class': 'el-pagination__total' },
|
822 | [this.t('el.pagination.total', { total: this.$parent.total })]
|
823 | ) : '';
|
824 | }
|
825 | },
|
826 |
|
827 | Pager: pager
|
828 | },
|
829 |
|
830 | methods: {
|
831 | handleCurrentChange: function handleCurrentChange(val) {
|
832 | this.internalCurrentPage = this.getValidCurrentPage(val);
|
833 | this.userChangePageSize = true;
|
834 | this.emitChange();
|
835 | },
|
836 | prev: function prev() {
|
837 | if (this.disabled) return;
|
838 | var newVal = this.internalCurrentPage - 1;
|
839 | this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
840 | this.$emit('prev-click', this.internalCurrentPage);
|
841 | this.emitChange();
|
842 | },
|
843 | next: function next() {
|
844 | if (this.disabled) return;
|
845 | var newVal = this.internalCurrentPage + 1;
|
846 | this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
847 | this.$emit('next-click', this.internalCurrentPage);
|
848 | this.emitChange();
|
849 | },
|
850 | getValidCurrentPage: function getValidCurrentPage(value) {
|
851 | value = parseInt(value, 10);
|
852 |
|
853 | var havePageCount = typeof this.internalPageCount === 'number';
|
854 |
|
855 | var resetValue = void 0;
|
856 | if (!havePageCount) {
|
857 | if (isNaN(value) || value < 1) resetValue = 1;
|
858 | } else {
|
859 | if (value < 1) {
|
860 | resetValue = 1;
|
861 | } else if (value > this.internalPageCount) {
|
862 | resetValue = this.internalPageCount;
|
863 | }
|
864 | }
|
865 |
|
866 | if (resetValue === undefined && isNaN(value)) {
|
867 | resetValue = 1;
|
868 | } else if (resetValue === 0) {
|
869 | resetValue = 1;
|
870 | }
|
871 |
|
872 | return resetValue === undefined ? value : resetValue;
|
873 | },
|
874 | emitChange: function emitChange() {
|
875 | var _this2 = this;
|
876 |
|
877 | this.$nextTick(function () {
|
878 | if (_this2.internalCurrentPage !== _this2.lastEmittedPage || _this2.userChangePageSize) {
|
879 | _this2.$emit('current-change', _this2.internalCurrentPage);
|
880 | _this2.lastEmittedPage = _this2.internalCurrentPage;
|
881 | _this2.userChangePageSize = false;
|
882 | }
|
883 | });
|
884 | }
|
885 | },
|
886 |
|
887 | computed: {
|
888 | internalPageCount: function internalPageCount() {
|
889 | if (typeof this.total === 'number') {
|
890 | return Math.max(1, Math.ceil(this.total / this.internalPageSize));
|
891 | } else if (typeof this.pageCount === 'number') {
|
892 | return Math.max(1, this.pageCount);
|
893 | }
|
894 | return null;
|
895 | }
|
896 | },
|
897 |
|
898 | watch: {
|
899 | currentPage: {
|
900 | immediate: true,
|
901 | handler: function handler(val) {
|
902 | this.internalCurrentPage = this.getValidCurrentPage(val);
|
903 | }
|
904 | },
|
905 |
|
906 | pageSize: {
|
907 | immediate: true,
|
908 | handler: function handler(val) {
|
909 | this.internalPageSize = isNaN(val) ? 10 : val;
|
910 | }
|
911 | },
|
912 |
|
913 | internalCurrentPage: {
|
914 | immediate: true,
|
915 | handler: function handler(newVal) {
|
916 | this.$emit('update:currentPage', newVal);
|
917 | this.lastEmittedPage = -1;
|
918 | }
|
919 | },
|
920 |
|
921 | internalPageCount: function internalPageCount(newVal) {
|
922 |
|
923 | var oldPage = this.internalCurrentPage;
|
924 | if (newVal > 0 && oldPage === 0) {
|
925 | this.internalCurrentPage = 1;
|
926 | } else if (oldPage > newVal) {
|
927 | this.internalCurrentPage = newVal === 0 ? 1 : newVal;
|
928 | this.userChangePageSize && this.emitChange();
|
929 | }
|
930 | this.userChangePageSize = false;
|
931 | }
|
932 | }
|
933 | });
|
934 |
|
935 |
|
936 |
|
937 |
|
938 | pagination.install = function (Vue) {
|
939 | Vue.component(pagination.name, pagination);
|
940 | };
|
941 |
|
942 | var packages_pagination = __webpack_exports__["default"] = (pagination);
|
943 |
|
944 | })
|
945 |
|
946 | }); |
\ | No newline at end of file |