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AAgB,KAAK,QAAL,CAAc,GAAd,GAAoB,KAAK,QAAzB,GAAoC,KAAK,QAAzD,EAAmE,KAAK,KAAL,IAAc,KAAK,MAAtF,EAA8F,KAAK,IAAnG,CAHe,CAAjB;AAMA,eAAO,EAAE,IAAF,EAAQ;AACb,wBAAY,CAAC;AACX,2BAAW,EAAE,OAAO,IAAT,EADA;AAEX,sBAAM,QAFK;AAGX,uBAAO,KAAK;AAHD,aAAD,CADC;AAMb,mBAAO,KAAK;AANC,SAAR,EAOJ,QAPI,CAAP;AAQD;AA/KgD,CAApC,C","sourcesContent":["import '../../stylus/components/_pagination.styl'\n\nimport VIcon from '../VIcon'\n\n// Directives\nimport Resize from '../../directives/resize'\n\n// Mixins\nimport mixins from '../../util/mixins'\nimport Colorable from '../../mixins/colorable'\nimport Themeable from '../../mixins/themeable'\n\n// Types\nimport { VNode, CreateElement } from 'vue'\n\n/* @vue/component */\nexport default mixins(Colorable, Themeable).extend({\n name: 'v-pagination',\n\n directives: { Resize },\n\n props: {\n circle: Boolean,\n disabled: Boolean,\n length: {\n type: Number,\n default: 0,\n validator: (val: number) => val % 1 === 0\n },\n totalVisible: [Number, String],\n nextIcon: {\n type: String,\n default: '$vuetify.icons.next'\n },\n prevIcon: {\n type: String,\n default: '$vuetify.icons.prev'\n },\n value: {\n type: Number,\n default: 0\n }\n },\n\n data () {\n return {\n maxButtons: 0,\n selected: null as number | null\n }\n },\n\n computed: {\n classes (): object {\n return {\n 'v-pagination': true,\n 'v-pagination--circle': this.circle,\n 'v-pagination--disabled': this.disabled,\n ...this.themeClasses\n }\n },\n\n items (): (string | number)[] {\n const maxLength = parseInt(this.totalVisible, 10) || this.maxButtons\n if (this.length <= maxLength) {\n return this.range(1, this.length)\n }\n\n const even = maxLength % 2 === 0 ? 1 : 0\n const left = Math.floor(maxLength / 2)\n const right = this.length - left + 1 + even\n\n if (this.value > left && this.value < right) {\n const start = this.value - left + 2\n const end = this.value + left - 2 - even\n\n return [1, '...', ...this.range(start, end), '...', this.length]\n } else if (this.value === left) {\n const end = this.value + left - 1 - even\n return [...this.range(1, end), '...', this.length]\n } else if (this.value === right) {\n const start = this.value - left + 1\n return [1, '...', ...this.range(start, this.length)]\n } else {\n return [\n ...this.range(1, left),\n '...',\n ...this.range(right, this.length)\n ]\n }\n }\n },\n\n watch: {\n value () {\n this.init()\n }\n },\n\n mounted () {\n this.init()\n },\n\n methods: {\n init () {\n this.selected = null\n\n this.$nextTick(this.onResize)\n // TODO: Change this (f75dee3a, cbdf7caa)\n setTimeout(() => (this.selected = this.value), 100)\n },\n onResize () {\n const width = this.$el && this.$el.parentElement\n ? this.$el.parentElement.clientWidth\n : window.innerWidth\n\n this.maxButtons = Math.floor((width - 96) / 42)\n },\n next (e: Event) {\n e.preventDefault()\n this.$emit('input', this.value + 1)\n this.$emit('next')\n },\n previous (e: Event) {\n e.preventDefault()\n this.$emit('input', this.value - 1)\n this.$emit('previous')\n },\n range (from: number, to: number) {\n const range = []\n\n from = from > 0 ? from : 1\n\n for (let i = from; i <= to; i++) {\n range.push(i)\n }\n\n return range\n },\n genIcon (h: CreateElement, icon: string, disabled: boolean, fn: EventListener): VNode {\n return h('li', [\n h('button', {\n staticClass: 'v-pagination__navigation',\n class: {\n 'v-pagination__navigation--disabled': disabled\n },\n attrs: {\n type: 'button'\n },\n on: disabled ? {} : { click: fn }\n }, [h(VIcon, [icon])])\n ])\n },\n genItem (h: CreateElement, i: string | number): VNode {\n const color: string | false = (i === this.value) && (this.color || 'primary')\n return h('button', this.setBackgroundColor(color, {\n staticClass: 'v-pagination__item',\n class: {\n 'v-pagination__item--active': i === this.value\n },\n attrs: {\n type: 'button'\n },\n on: {\n click: () => this.$emit('input', i)\n }\n }), [i.toString()])\n },\n genItems (h: CreateElement): VNode[] {\n return this.items.map((i, index) => {\n return h('li', { key: index }, [\n isNaN(Number(i)) ? h('span', { class: 'v-pagination__more' }, [i.toString()]) : this.genItem(h, i)\n ])\n })\n }\n },\n\n render (h): VNode {\n const children = [\n this.genIcon(h, this.$vuetify.rtl ? this.nextIcon : this.prevIcon, this.value <= 1, this.previous),\n this.genItems(h),\n this.genIcon(h, this.$vuetify.rtl ? this.prevIcon : this.nextIcon, this.value >= this.length, this.next)\n ]\n\n return h('ul', {\n directives: [{\n modifiers: { quiet: true },\n name: 'resize',\n value: this.onResize\n }],\n class: this.classes\n }, children)\n }\n})\n"],"sourceRoot":""}
|