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PK,CAAR;AAQD;AA/KgD,CAApC,C","sourcesContent":["import './VPagination.sass'\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 nextIcon: {\n type: String,\n default: '$vuetify.icons.next',\n },\n prevIcon: {\n type: String,\n default: '$vuetify.icons.prev',\n },\n totalVisible: [Number, String],\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":"","file":"VPagination.js"} |