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B,CAAqB,+BAArB,CAHa,EAIb,KAAK,QAAL,CAAc,GAAd,GAAoB,KAAK,QAAzB,GAAoC,KAAK,SAJ5B,CAAf;AAOA,QAAA,KAAK,CAAC,IAAN,CAAW,KAAK,OAAL,CACT,KAAK,UADI,EAET,KAAK,OAAL,CAAa,IAAb,KAAsB,KAAK,UAAL,CAAgB,SAAtC,IAAmD,KAAK,OAAL,CAAa,YAAb,KAA8B,CAAC,CAFzE,EAGT,KAAK,QAAL,CAAc,IAAd,CAAmB,CAAnB,CAAqB,8BAArB,CAHS,EAIT,KAAK,QAAL,CAAc,GAAd,GAAoB,KAAK,SAAzB,GAAqC,KAAK,QAJjC,CAAX;AAMD;;AAED,aAAO,CACL,KAAK,cAAL,CAAoB,KAApB,EAA2B;AACzB,QAAA,WAAW,EAAE;AADY,OAA3B,EAEG,MAFH,CADK,EAIL,KAAK,eAAL,IAAwB,KAAK,cAAL,CAAoB,MAApB,EAA4B,CAAC,KAAK,OAAL,CAAa,IAAb,CAAkB,QAAlB,EAAD,CAA5B,CAJnB,EAKL,KAAK,cAAL,CAAoB,KAApB,EAA2B;AACzB,QAAA,WAAW,EAAE;AADY,OAA3B,EAEG,KAFH,CALK,CAAP;AASD;AA/HM,GA1Ee;AA4MxB,EAAA,MA5MwB,oBA4MlB;AACJ,WAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B;AAChC,MAAA,WAAW,EAAE;AADmB,KAA3B,EAEJ,CACD,KAAK,qBAAL,EADC,EAED,KAAK,iBAAL,EAFC,EAGD,KAAK,QAAL,EAHC,CAFI,CAAP;AAOD;AApNuB,CAAX,C","sourcesContent":["import './VDataFooter.sass'\n\n// Components\nimport VSelect from '../VSelect/VSelect'\nimport VIcon from '../VIcon'\nimport VBtn from '../VBtn'\n\n// Types\nimport Vue, { VNode, VNodeChildrenArrayContents } from 'vue'\nimport { DataOptions, DataPagination } from '../VData/VData'\nimport { PropValidator } from 'vue/types/options'\n\nexport default Vue.extend({\n name: 'v-data-footer',\n\n props: {\n options: {\n type: Object,\n required: true,\n } as PropValidator<DataOptions>,\n pagination: {\n type: Object,\n required: true,\n } as PropValidator<DataPagination>,\n itemsPerPageOptions: {\n type: Array,\n default: () => ([5, 10, 15, -1]),\n } as PropValidator<any[]>,\n prevIcon: {\n type: String,\n default: '$vuetify.icons.prev',\n },\n nextIcon: {\n type: String,\n default: '$vuetify.icons.next',\n },\n firstIcon: {\n type: String,\n default: '$vuetify.icons.first',\n },\n lastIcon: {\n type: String,\n default: '$vuetify.icons.last',\n },\n itemsPerPageText: {\n type: String,\n default: '$vuetify.dataFooter.itemsPerPageText',\n },\n itemsPerPageAllText: {\n type: String,\n default: '$vuetify.dataFooter.itemsPerPageAll',\n },\n showFirstLastPage: Boolean,\n showCurrentPage: Boolean,\n disablePagination: Boolean,\n disableItemsPerPage: Boolean,\n },\n\n computed: {\n disableNextPageIcon (): boolean {\n return this.options.itemsPerPage < 0 ||\n this.options.page * this.options.itemsPerPage >= this.pagination.itemsLength ||\n this.pagination.pageStop < 0\n },\n computedItemsPerPageOptions (): any[] {\n const itemsPerPageOptions = this.itemsPerPageOptions.map(option => {\n if (typeof option === 'object') return option\n else return this.genItemsPerPageOption(option)\n })\n\n const customItemsPerPage = !itemsPerPageOptions.find(option => option.value === this.options.itemsPerPage)\n\n if (customItemsPerPage) {\n itemsPerPageOptions.push(this.genItemsPerPageOption(this.options.itemsPerPage))\n\n itemsPerPageOptions.sort((a, b) => {\n if (a.value === -1) return 1\n else if (b.value === -1) return -1\n else return a.value - b.value\n })\n }\n\n return itemsPerPageOptions\n },\n },\n\n methods: {\n updateOptions (obj: object) {\n this.$emit('update:options', Object.assign({}, this.options, obj))\n },\n onFirstPage () {\n this.updateOptions({ page: 1 })\n },\n onPreviousPage () {\n this.updateOptions({ page: this.options.page - 1 })\n },\n onNextPage () {\n this.updateOptions({ page: this.options.page + 1 })\n },\n onLastPage () {\n this.updateOptions({ page: this.pagination.pageCount })\n },\n onChangeItemsPerPage (itemsPerPage: number) {\n this.updateOptions({ itemsPerPage, page: 1 })\n },\n genItemsPerPageOption (option: number) {\n return {\n text: option === -1 ? this.$vuetify.lang.t(this.itemsPerPageAllText) : String(option),\n value: option,\n }\n },\n genItemsPerPageSelect () {\n return this.$createElement('div', {\n staticClass: 'v-data-footer__select',\n }, [\n this.$vuetify.lang.t(this.itemsPerPageText),\n this.$createElement(VSelect, {\n attrs: {\n 'aria-label': this.itemsPerPageText,\n },\n props: {\n disabled: this.disableItemsPerPage,\n items: this.computedItemsPerPageOptions,\n value: this.options.itemsPerPage,\n hideDetails: true,\n auto: true,\n minWidth: '75px',\n },\n on: {\n input: this.onChangeItemsPerPage,\n },\n }),\n ])\n },\n genPaginationInfo () {\n let children: VNodeChildrenArrayContents = ['–']\n\n if (this.pagination.itemsLength) {\n const itemsLength = this.pagination.itemsLength\n const pageStart = this.pagination.pageStart + 1\n const pageStop = itemsLength < this.pagination.pageStop || this.pagination.pageStop < 0\n ? itemsLength\n : this.pagination.pageStop\n\n children = this.$scopedSlots['page-text']\n ? [this.$scopedSlots['page-text']!({ pageStart, pageStop, itemsLength })]\n : [this.$vuetify.lang.t('$vuetify.dataIterator.pageText', pageStart, pageStop, itemsLength)]\n }\n\n return this.$createElement('div', {\n class: 'v-data-footer__pagination',\n }, children)\n },\n genIcon (click: Function, disabled: boolean, label: string, icon: string): VNode {\n return this.$createElement(VBtn, {\n props: {\n disabled: disabled || this.disablePagination,\n icon: true,\n text: true,\n // dark: this.dark, // TODO: add mixin\n // light: this.light // TODO: add mixin\n },\n on: {\n click,\n },\n attrs: {\n 'aria-label': label, // TODO: Localization\n },\n }, [this.$createElement(VIcon, icon)])\n },\n genIcons () {\n const before: VNodeChildrenArrayContents = []\n const after: VNodeChildrenArrayContents = []\n\n before.push(this.genIcon(\n this.onPreviousPage,\n this.options.page === 1,\n this.$vuetify.lang.t('$vuetify.dataFooter.prevPage'),\n this.$vuetify.rtl ? this.nextIcon : this.prevIcon\n ))\n\n after.push(this.genIcon(\n this.onNextPage,\n this.disableNextPageIcon,\n this.$vuetify.lang.t('$vuetify.dataFooter.nextPage'),\n this.$vuetify.rtl ? this.prevIcon : this.nextIcon\n ))\n\n if (this.showFirstLastPage) {\n before.unshift(this.genIcon(\n this.onFirstPage,\n this.options.page === 1,\n this.$vuetify.lang.t('$vuetify.dataFooter.firstPage'),\n this.$vuetify.rtl ? this.lastIcon : this.firstIcon\n ))\n\n after.push(this.genIcon(\n this.onLastPage,\n this.options.page === this.pagination.pageCount || this.options.itemsPerPage === -1,\n this.$vuetify.lang.t('$vuetify.dataFooter.lastPage'),\n this.$vuetify.rtl ? this.firstIcon : this.lastIcon\n ))\n }\n\n return [\n this.$createElement('div', {\n staticClass: 'v-data-footer__icons-before',\n }, before),\n this.showCurrentPage && this.$createElement('span', [this.options.page.toString()]),\n this.$createElement('div', {\n staticClass: 'v-data-footer__icons-after',\n }, after),\n ]\n },\n },\n\n render (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-data-footer',\n }, [\n this.genItemsPerPageSelect(),\n this.genPaginationInfo(),\n this.genIcons(),\n ])\n },\n})\n"],"sourceRoot":"","file":"VDataFooter.js"} |