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AAL,CAAe,IAAf,CAAd,EAAjB,KACA,IAAI,IAAI,CAAC,OAAT,EAAkB,QAAQ,CAAC,IAAT,CAAc,KAAK,UAAL,CAAgB,IAAhB,CAAd,EAAlB,KACA,QAAQ,CAAC,IAAT,CAAc,KAAK,OAAL,CAAa,IAAb,CAAd;AACN;;AAED,IAAA,QAAQ,CAAC,MAAT,IAAmB,QAAQ,CAAC,IAAT,CAAc,KAAK,MAAL,CAAY,SAAZ,KAA0B,KAAK,gBAA7C,CAAnB;AAEA,SAAK,MAAL,CAAY,cAAZ,KAA+B,QAAQ,CAAC,OAAT,CAAiB,KAAK,MAAL,CAAY,cAAZ,CAAjB,CAA/B;AAEA,SAAK,MAAL,CAAY,aAAZ,KAA8B,QAAQ,CAAC,IAAT,CAAc,KAAK,MAAL,CAAY,aAAZ,CAAd,CAA9B;AAEA,WAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B;AAChC,MAAA,WAAW,EAAE,sBADmB;AAEhC,MAAA,KAAK,EAAE,KAAK;AAFoB,KAA3B,EAGJ,CACD,KAAK,cAAL,CAAoB,KAApB,EAA2B;AACzB,MAAA,KAAK,EAAE;AACL,QAAA,EAAE,EAAE,KAAK,MAAL,CAAY,EADX;AAEL,QAAA,IAAI,EAAE,SAFD;AAGL,QAAA,QAAQ,EAAE,CAAC;AAHN,OADkB;AAMzB,MAAA,KAAK,EAAE;AAAE,QAAA,KAAK,EAAE,KAAK;AAAd;AANkB,KAA3B,EAOG,QAPH,CADC,CAHI,CAAP;AAaD;;AA3OgD,CAApC,CAAf","sourcesContent":["// Styles\nimport '../VCard/VCard.sass'\n\n// Components\nimport VSimpleCheckbox from '../VCheckbox/VSimpleCheckbox'\nimport VDivider from '../VDivider'\nimport VSubheader from '../VSubheader'\nimport {\n VList,\n VListItem,\n VListItemAction,\n VListItemContent,\n VListItemTitle,\n} from '../VList'\n\n// Directives\nimport ripple from '../../directives/ripple'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport Themeable from '../../mixins/themeable'\n\n// Helpers\nimport {\n escapeHTML,\n getPropertyFromItem,\n} from '../../util/helpers'\n\n// Types\nimport mixins from '../../util/mixins'\nimport { VNode } from 'vue'\nimport { PropValidator } from 'vue/types/options'\n\n/* @vue/component */\nexport default mixins(Colorable, Themeable).extend({\n name: 'v-select-list',\n\n // https://github.com/vuejs/vue/issues/6872\n directives: {\n ripple,\n },\n\n props: {\n action: Boolean,\n dense: Boolean,\n hideSelected: Boolean,\n items: {\n type: Array,\n default: () => [],\n } as PropValidator<any[]>,\n itemDisabled: {\n type: [String, Array, Function],\n default: 'disabled',\n } as PropValidator<string | (string | number)[] | ((item: object, fallback?: any) => any)>,\n itemText: {\n type: [String, Array, Function],\n default: 'text',\n } as PropValidator<string | (string | number)[] | ((item: object, fallback?: any) => any)>,\n itemValue: {\n type: [String, Array, Function],\n default: 'value',\n } as PropValidator<string | (string | number)[] | ((item: object, fallback?: any) => any)>,\n noDataText: String,\n noFilter: Boolean,\n searchInput: {\n default: null,\n } as PropValidator<any>,\n selectedItems: {\n type: Array,\n default: () => [],\n } as PropValidator<any[]>,\n },\n\n computed: {\n parsedItems (): any[] {\n return this.selectedItems.map(item => this.getValue(item))\n },\n tileActiveClass (): string {\n return Object.keys(this.setTextColor(this.color).class || {}).join(' ')\n },\n staticNoDataTile (): VNode {\n const tile = {\n attrs: {\n role: undefined,\n },\n on: {\n mousedown: (e: Event) => e.preventDefault(), // Prevent onBlur from being called\n },\n }\n\n return this.$createElement(VListItem, tile, [\n this.genTileContent(this.noDataText),\n ])\n },\n },\n\n methods: {\n genAction (item: object, inputValue: any): VNode {\n return this.$createElement(VListItemAction, [\n this.$createElement(VSimpleCheckbox, {\n props: {\n color: this.color,\n value: inputValue,\n },\n on: {\n input: () => this.$emit('select', item),\n },\n }),\n ])\n },\n genDivider (props: { [key: string]: any }) {\n return this.$createElement(VDivider, { props })\n },\n genFilteredText (text: string) {\n text = text || ''\n\n if (!this.searchInput || this.noFilter) return escapeHTML(text)\n\n const { start, middle, end } = this.getMaskedCharacters(text)\n\n return `${escapeHTML(start)}${this.genHighlight(middle)}${escapeHTML(end)}`\n },\n genHeader (props: { [key: string]: any }): VNode {\n return this.$createElement(VSubheader, { props }, props.header)\n },\n genHighlight (text: string): string {\n return `<span class=\"v-list-item__mask\">${escapeHTML(text)}</span>`\n },\n genLabelledBy (item: object) {\n const text = escapeHTML(this.getText(item).split(' ').join('-').toLowerCase())\n\n return `${text}-list-item-${this._uid}`\n },\n getMaskedCharacters (text: string): {\n start: string\n middle: string\n end: string\n } {\n const searchInput = (this.searchInput || '').toString().toLocaleLowerCase()\n const index = text.toLocaleLowerCase().indexOf(searchInput)\n\n if (index < 0) return { start: '', middle: text, end: '' }\n\n const start = text.slice(0, index)\n const middle = text.slice(index, index + searchInput.length)\n const end = text.slice(index + searchInput.length)\n return { start, middle, end }\n },\n genTile (\n item: object,\n disabled = null as null | boolean,\n value = false\n ): VNode | VNode[] | undefined {\n if (!value) value = this.hasItem(item)\n\n if (item === Object(item)) {\n disabled = disabled !== null\n ? disabled\n : this.getDisabled(item)\n }\n\n const tile = {\n attrs: {\n // Default behavior in list does not\n // contain aria-selected by default\n 'aria-selected': String(value),\n 'aria-labelledby': this.genLabelledBy(item),\n role: 'option',\n },\n on: {\n mousedown: (e: Event) => {\n // Prevent onBlur from being called\n e.preventDefault()\n },\n click: () => disabled || this.$emit('select', item),\n },\n props: {\n activeClass: this.tileActiveClass,\n disabled,\n ripple: true,\n inputValue: value,\n },\n }\n\n if (!this.$scopedSlots.item) {\n return this.$createElement(VListItem, tile, [\n this.action && !this.hideSelected && this.items.length > 0\n ? this.genAction(item, value)\n : null,\n this.genTileContent(item),\n ])\n }\n\n const parent = this\n const scopedSlot = this.$scopedSlots.item({\n parent,\n item,\n attrs: {\n ...tile.attrs,\n ...tile.props,\n },\n on: tile.on,\n })\n\n return this.needsTile(scopedSlot)\n ? this.$createElement(VListItem, tile, scopedSlot)\n : scopedSlot\n },\n genTileContent (item: any): VNode {\n const innerHTML = this.genFilteredText(this.getText(item))\n\n return this.$createElement(VListItemContent,\n [this.$createElement(VListItemTitle, {\n attrs: { id: this.genLabelledBy(item) },\n domProps: { innerHTML },\n })]\n )\n },\n hasItem (item: object) {\n return this.parsedItems.indexOf(this.getValue(item)) > -1\n },\n needsTile (slot: VNode[] | undefined) {\n return slot!.length !== 1 ||\n slot![0].componentOptions == null ||\n slot![0].componentOptions.Ctor.options.name !== 'v-list-item'\n },\n getDisabled (item: object) {\n return Boolean(getPropertyFromItem(item, this.itemDisabled, false))\n },\n getText (item: object) {\n return String(getPropertyFromItem(item, this.itemText, item))\n },\n getValue (item: object) {\n return getPropertyFromItem(item, this.itemValue, this.getText(item))\n },\n },\n\n render (): VNode {\n const children = []\n for (const item of this.items) {\n if (this.hideSelected &&\n this.hasItem(item)\n ) continue\n\n if (item == null) children.push(this.genTile(item))\n else if (item.header) children.push(this.genHeader(item))\n else if (item.divider) children.push(this.genDivider(item))\n else children.push(this.genTile(item))\n }\n\n children.length || children.push(this.$slots['no-data'] || this.staticNoDataTile)\n\n this.$slots['prepend-item'] && children.unshift(this.$slots['prepend-item'])\n\n this.$slots['append-item'] && children.push(this.$slots['append-item'])\n\n return this.$createElement('div', {\n staticClass: 'v-select-list v-card',\n class: this.themeClasses,\n }, [\n this.$createElement(VList, {\n attrs: {\n id: this.$attrs.id,\n role: 'listbox',\n tabindex: -1,\n },\n props: { dense: this.dense },\n }, children),\n ])\n },\n})\n"],"sourceRoot":"","file":"VSelectList.js"} |