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OALhB;AAOA,IAAA,GAAG,GAAG,KAAK,QAAL,GAAgB,KAAhB,GAAwB,GAA9B;AAEA,WAAO,CAAC,CAAC,GAAD,EAAM,KAAK,YAAL,CAAkB,KAAK,KAAvB,EAA8B,IAA9B,CAAN,EAA2C,QAA3C,CAAR;AACD;AAzIgD,CAApC,C","sourcesContent":["// Styles\nimport './VListItem.sass'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport Routable from '../../mixins/routable'\nimport { factory as GroupableFactory } from '../../mixins/groupable'\nimport Themeable from '../../mixins/themeable'\nimport { factory as ToggleableFactory } from '../../mixins/toggleable'\n\n// Directives\nimport Ripple from '../../directives/ripple'\n\n// Utilities\nimport { keyCodes } from './../../util/helpers'\nimport { ExtractVue } from './../../util/mixins'\nimport { removed } from '../../util/console'\n\n// Types\nimport mixins from '../../util/mixins'\nimport { VNode } from 'vue'\nimport { PropValidator } from 'vue/types/options'\n\nconst baseMixins = mixins(\n Colorable,\n Routable,\n Themeable,\n GroupableFactory('listItemGroup'),\n ToggleableFactory('inputValue')\n)\n\ninterface options extends ExtractVue<typeof baseMixins> {\n $el: HTMLElement\n isInGroup: boolean\n isInList: boolean\n isInMenu: boolean\n isInNav: boolean\n}\n\n/* @vue/component */\nexport default baseMixins.extend<options>().extend({\n name: 'v-list-item',\n\n directives: {\n Ripple,\n },\n\n inheritAttrs: false,\n\n inject: {\n isInGroup: {\n default: false,\n },\n isInList: {\n default: false,\n },\n isInMenu: {\n default: false,\n },\n isInNav: {\n default: false,\n },\n },\n\n props: {\n activeClass: {\n type: String,\n default (): string | undefined {\n if (!this.listItemGroup) return ''\n\n return this.listItemGroup.activeClass\n },\n } as any as PropValidator<string>,\n dense: Boolean,\n inactive: Boolean,\n link: Boolean,\n tag: {\n type: String,\n default: 'div',\n },\n threeLine: Boolean,\n twoLine: Boolean,\n value: null as any as PropValidator<any>,\n },\n\n data: () => ({\n proxyClass: 'v-list-item--active',\n }),\n\n computed: {\n classes (): object {\n return {\n 'v-list-item': true,\n ...Routable.options.computed.classes.call(this),\n 'v-list-item--dense': this.dense,\n 'v-list-item--disabled': this.disabled,\n 'v-list-item--link': this.isClickable && !this.inactive,\n 'v-list-item--three-line': this.threeLine,\n 'v-list-item--two-line': this.twoLine,\n ...this.themeClasses,\n }\n },\n isClickable (): boolean {\n return Boolean(\n Routable.options.computed.isClickable.call(this) ||\n this.listItemGroup\n )\n },\n },\n\n created () {\n /* istanbul ignore next */\n if (this.$attrs.hasOwnProperty('avatar')) {\n removed('avatar', this)\n }\n },\n\n methods: {\n click (e: MouseEvent | KeyboardEvent) {\n if (e.detail) this.$el.blur()\n\n this.$emit('click', e)\n\n this.to || this.toggle()\n },\n genAttrs () {\n const attrs: Record<string, any> = {\n 'aria-disabled': this.disabled ? true : undefined,\n tabindex: this.isClickable && !this.disabled ? 0 : -1,\n ...this.$attrs,\n }\n\n if (this.$attrs.hasOwnProperty('role')) {\n // do nothing, role already provided\n } else if (this.isInNav) {\n // do nothing, role is inherit\n } else if (this.isInGroup) {\n attrs.role = 'listitem'\n attrs['aria-selected'] = String(this.isActive)\n } else if (this.isInMenu) {\n attrs.role = this.isClickable ? 'menuitem' : undefined\n } else if (this.isInList && !this.isLink) {\n attrs.role = 'listitem'\n }\n\n return attrs\n },\n },\n\n render (h): VNode {\n let { tag, data } = this.generateRouteLink()\n\n data.attrs = {\n ...data.attrs,\n ...this.genAttrs(),\n }\n data.on = {\n ...data.on,\n click: this.click,\n keydown: (e: KeyboardEvent) => {\n /* istanbul ignore else */\n if (e.keyCode === keyCodes.enter) this.click(e)\n\n this.$emit('keydown', e)\n },\n }\n\n const children = this.$scopedSlots.default\n ? this.$scopedSlots.default({\n active: this.isActive,\n toggle: this.toggle,\n })\n : this.$slots.default\n\n tag = this.inactive ? 'div' : tag\n\n return h(tag, this.setTextColor(this.color, data), children)\n },\n})\n"],"sourceRoot":"","file":"VListItem.js"} |