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AAC,CAAD;AAAA,iBAAY,OAAI,CAAC,KAAL,CAAW,mBAAX,EAAgC,CAAhC,CAAZ;AAAA,SAPnB;AAQF,QAAA,UAAU,EAAE,oBAAC,CAAD,EAAS,GAAT;AAAA,iBAAsB,CAAC,wBAAU,CAAV,EAAa,GAAb,CAAD,IAAsB,OAAI,CAAC,KAAL,CAAW,YAAX,EAAyB,CAAzB,CAA5C;AAAA,SARV;AASF,yBAAiB,sBAAC,CAAD,EAAa;AAC5B,UAAA,OAAI,CAAC,oBAAL,GAA4B,CAA5B;;AACA,UAAA,OAAI,CAAC,KAAL,CAAW,eAAX,EAA4B,CAA5B;AACD;AAZC,OAF4B;AAgBhC,MAAA,WAAW,EAAE;AACX,QAAA,OAAO,EAAE,KAAK;AADH;AAhBmB,KAA3B,CAAP;AAoBD;AArQ6B,CAAjB,C","sourcesContent":["import { VNode, VNodeChildren } from 'vue'\n\n// Components\nimport { VData } from '../VData'\nimport VDataFooter from './VDataFooter'\n\n// Mixins\nimport Themeable from '../../mixins/themeable'\n\n// Helpers\nimport { deepEqual, getObjectValueByPath, getPrefixedScopedSlots, getSlot } from '../../util/helpers'\nimport { DataProps } from '../VData/VData'\nimport { PropValidator } from 'vue/types/options'\nimport { breaking, removed } from '../../util/console'\n\n/* @vue/component */\nexport default Themeable.extend({\n name: 'v-data-iterator',\n\n props: {\n ...VData.options.props, // TODO: filter out props not used\n itemKey: {\n type: String,\n default: 'id',\n },\n value: {\n type: Array,\n default: () => [],\n } as PropValidator<any[]>,\n singleSelect: Boolean,\n expanded: {\n type: Array,\n default: () => [],\n } as PropValidator<any[]>,\n singleExpand: Boolean,\n loading: [Boolean, String],\n noResultsText: {\n type: String,\n default: '$vuetify.dataIterator.noResultsText',\n },\n noDataText: {\n type: String,\n default: '$vuetify.noDataText',\n },\n loadingText: {\n type: String,\n default: '$vuetify.dataIterator.loadingText',\n },\n hideDefaultFooter: Boolean,\n footerProps: Object,\n },\n\n data: () => ({\n selection: {} as Record<string, any>,\n expansion: {} as Record<string, boolean>,\n internalCurrentItems: [] as any[],\n }),\n\n computed: {\n everyItem (): boolean {\n return !!this.internalCurrentItems.length && this.internalCurrentItems.every((i: any) => this.isSelected(i))\n },\n someItems (): boolean {\n return this.internalCurrentItems.some((i: any) => this.isSelected(i))\n },\n },\n\n watch: {\n value: {\n handler (value: any[]) {\n this.selection = value.reduce((selection, item) => {\n selection[getObjectValueByPath(item, this.itemKey)] = item\n return selection\n }, {})\n },\n immediate: true,\n },\n selection (value: Record<string, boolean>, old: Record<string, boolean>) {\n if (deepEqual(Object.keys(value), Object.keys(old))) return\n\n this.$emit('input', Object.values(value))\n },\n expanded: {\n handler (value: any[]) {\n this.expansion = value.reduce((expansion, item) => {\n expansion[getObjectValueByPath(item, this.itemKey)] = true\n return expansion\n }, {})\n },\n immediate: true,\n },\n expansion (value: Record<string, boolean>, old: Record<string, boolean>) {\n if (deepEqual(value, old)) return\n const keys = Object.keys(value).filter(k => value[k])\n const expanded = !keys.length ? [] : this.items.filter(i => keys.includes(String(getObjectValueByPath(i, this.itemKey))))\n this.$emit('update:expanded', expanded)\n },\n },\n\n created () {\n const breakingProps = [\n ['disable-initial-sort', 'sort-by'],\n ['filter', 'custom-filter'],\n ['pagination', 'options'],\n ['total-items', 'server-items-length'],\n ['hide-actions', 'hide-default-footer'],\n ['rows-per-page-items', 'footer-props.items-per-page-options'],\n ['rows-per-page-text', 'footer-props.items-per-page-text'],\n ['prev-icon', 'footer-props.prev-icon'],\n ['next-icon', 'footer-props.next-icon'],\n ]\n\n /* istanbul ignore next */\n breakingProps.forEach(([original, replacement]) => {\n if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this)\n })\n\n const removedProps = [\n 'expand',\n 'content-class',\n 'content-props',\n 'content-tag',\n ]\n\n /* istanbul ignore next */\n removedProps.forEach(prop => {\n if (this.$attrs.hasOwnProperty(prop)) removed(prop)\n })\n },\n\n methods: {\n toggleSelectAll (value: boolean): void {\n const selection = Object.assign({}, this.selection)\n\n this.internalCurrentItems.forEach((item: any) => {\n const key = getObjectValueByPath(item, this.itemKey)\n if (value) selection[key] = item\n else delete selection[key]\n })\n\n this.selection = selection\n },\n isSelected (item: any): boolean {\n return !!this.selection[getObjectValueByPath(item, this.itemKey)] || false\n },\n select (item: any, value = true, emit = true): void {\n const selection = this.singleSelect ? {} : Object.assign({}, this.selection)\n const key = getObjectValueByPath(item, this.itemKey)\n\n if (value) selection[key] = item\n else delete selection[key]\n\n this.selection = selection\n emit && this.$emit('item-selected', { item, value })\n },\n isExpanded (item: any): boolean {\n return this.expansion[getObjectValueByPath(item, this.itemKey)] || false\n },\n expand (item: any, value = true): void {\n const expansion = this.singleExpand ? {} : Object.assign({}, this.expansion)\n const key = getObjectValueByPath(item, this.itemKey)\n\n if (value) expansion[key] = true\n else delete expansion[key]\n\n this.expansion = expansion\n this.$emit('item-expanded', { item, value })\n },\n createItemProps (item: any) {\n const props = {\n item,\n select: (v: boolean) => this.select(item, v),\n isSelected: this.isSelected(item),\n expand: (v: boolean) => this.expand(item, v),\n isExpanded: this.isExpanded(item),\n }\n\n return props\n },\n genEmptyWrapper (content: VNodeChildren) {\n return this.$createElement('div', content)\n },\n genEmpty (itemsLength: number) {\n if (itemsLength <= 0 && this.loading) {\n const loading = this.$slots['loading'] || this.$vuetify.lang.t(this.loadingText)\n return this.genEmptyWrapper(loading)\n } else if (itemsLength <= 0 && !this.items.length) {\n const noData = this.$slots['no-data'] || this.$vuetify.lang.t(this.noDataText)\n return this.genEmptyWrapper(noData)\n } else if (itemsLength <= 0 && this.search) {\n const noResults = this.$slots['no-results'] || this.$vuetify.lang.t(this.noResultsText)\n return this.genEmptyWrapper(noResults)\n }\n\n return null\n },\n genItems (props: DataProps) {\n const empty = this.genEmpty(props.pagination.itemsLength)\n if (empty) return [empty]\n\n if (this.$scopedSlots.default) {\n return this.$scopedSlots.default({\n ...props,\n isSelected: this.isSelected,\n select: this.select,\n isExpanded: this.isExpanded,\n expand: this.expand,\n })\n }\n\n if (this.$scopedSlots.item) {\n return props.items.map((item: any) => this.$scopedSlots.item!(this.createItemProps(item)))\n }\n\n return []\n },\n genFooter (props: DataProps) {\n if (this.hideDefaultFooter) return null\n\n const data = {\n props: {\n ...this.footerProps,\n options: props.options,\n pagination: props.pagination,\n },\n on: {\n 'update:options': (value: any) => props.updateOptions(value),\n },\n }\n\n const scopedSlots = getPrefixedScopedSlots('footer.', this.$scopedSlots)\n\n return this.$createElement(VDataFooter, {\n scopedSlots,\n ...data,\n })\n },\n genDefaultScopedSlot (props: any) {\n const outerProps = {\n ...props,\n someItems: this.someItems,\n everyItem: this.everyItem,\n toggleSelectAll: this.toggleSelectAll,\n }\n\n return this.$createElement('div', {\n staticClass: 'v-data-iterator',\n }, [\n getSlot(this, 'header', outerProps, true),\n this.genItems(props),\n this.genFooter(props),\n getSlot(this, 'footer', outerProps, true),\n ])\n },\n },\n\n render (): VNode {\n return this.$createElement(VData, {\n props: this.$props,\n on: {\n 'update:options': (v: any, old: any) => !deepEqual(v, old) && this.$emit('update:options', v),\n 'update:page': (v: any) => this.$emit('update:page', v),\n 'update:items-per-page': (v: any) => this.$emit('update:items-per-page', v),\n 'update:sort-by': (v: any) => this.$emit('update:sort-by', v),\n 'update:sort-desc': (v: any) => this.$emit('update:sort-desc', v),\n 'update:group-by': (v: any) => this.$emit('update:group-by', v),\n 'update:group-desc': (v: any) => this.$emit('update:group-desc', v),\n pagination: (v: any, old: any) => !deepEqual(v, old) && this.$emit('pagination', v),\n 'current-items': (v: any[]) => {\n this.internalCurrentItems = v\n this.$emit('current-items', v)\n },\n },\n scopedSlots: {\n default: this.genDefaultScopedSlot,\n },\n })\n },\n})\n"],"sourceRoot":"","file":"VDataIterator.js"} |