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CAAc,KAAK,SAAL,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;AAXG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAaJ,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,YAApB,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,C","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"} |