1 line
6.7 KiB
Plaintext
1 line
6.7 KiB
Plaintext
|
{"version":3,"file":"VOverflowBtn.mjs","names":["VSelect","VAutocomplete","VTextField","VBtn","consoleWarn","extend","name","props","editable","Boolean","segmented","computed","classes","options","call","isAnyValueAllowed","isSingle","computedItems","allItems","filteredItems","labelValue","isFocused","persistentPlaceholder","isLabelActive","methods","genSelections","genCommaSelection","item","index","last","genSegmentedBtn","genInput","input","data","domProps","value","internalSearch","attrs","readonly","genLabel","label","style","itemValue","getValue","itemObj","find","i","text","callback","$createElement","on","click","e","stopPropagation","updateValue","val","initialValue","lazyValue","$emit"],"sources":["../../../src/components/VOverflowBtn/VOverflowBtn.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable */\n\n// Styles\nimport './VOverflowBtn.sass'\n\n// Extensions\nimport VSelect from '../VSelect/VSelect'\nimport VAutocomplete from '../VAutocomplete'\nimport VTextField from '../VTextField/VTextField'\n\n// Components\nimport VBtn from '../VBtn'\n\n// Utilities\nimport { consoleWarn } from '../../util/console'\n\n/* @vue/component */\nexport default VAutocomplete.extend({\n name: 'v-overflow-btn',\n\n props: {\n editable: Boolean,\n segmented: Boolean,\n },\n\n computed: {\n classes (): object {\n return {\n ...VAutocomplete.options.computed.classes.call(this),\n 'v-overflow-btn': true,\n 'v-overflow-btn--segmented': this.segmented,\n 'v-overflow-btn--editable': this.editable,\n }\n },\n isAnyValueAllowed (): boolean {\n return this.editable ||\n VAutocomplete.options.computed.isAnyValueAllowed.call(this)\n },\n isSingle (): true {\n return true\n },\n computedItems (): object[] {\n return this.segmented ? this.allItems : this.filteredItems\n },\n labelValue (): boolean {\n return (this.isFocused && !this.persistentPlaceholder) || this.isLabelActive\n },\n },\n\n methods: {\n genSelections () {\n return this.editable\n ? VAutocomplete.options.methods.genSelections.call(this)\n : VSelect.options.methods.genSelections.call(this) // Override v-autocomplete's override\n },\n genCommaSelection (item: any, index: number, last: boolean) {\n return this.segmented\n ? this.genSegmentedBtn(item)\n : VSelect.options.methods.genCommaSelection.call(this, item, index, last)\n },\n genInput () {\n const input = VTextField.options.methods.genInput.call(this)\n\n input.data = input.data || {}\n input.data.domProps!.value = this.editable ? this.internalSearch : ''\n input.data.attrs!.readonly = !this.isAnyValueAllowed\n\n return input\n },\n genLabel () {\n if (this.editable && this.isFocused) return null\n\n const label = VTextField.options.methods.genLabel.call(this)\n\n if (!label) return label\n\n label.data = label.data || {}\n\n // Reset previously set styles from parent\n label.data.style = {}\n\n return label\n },\n genSegmentedBtn (item: any) {\n const itemValue = this.getValue(item)\n const itemObj = this.computedItems.find(i => this.getValue(i) === itemValue) || item\n\n if (!itemObj.text || !itemObj.callback) {\n consoleWarn('When using \"segmented\" prop without a selection slot, items must contain both a text and callback property', this)\n return null\n }\n\n return this.$createElement(VBtn, {\n props: { text: true },\n on: {\n click (e: Event) {\n e.stopPropagation()\n itemObj.callback(e)\n },\n },\n }, [itemObj.text])\n },\n updateValue (val: boolean) {\n if (val) {\n this.initialValue = this.lazyValue\n } else if (this.initialValue !== this.lazyValue) {\n this.$emit('change', this.lazyValue)\n }\n },\n },\n})\n"],"mappings":"AAAA;AACA;;AAEA;AACA;;AAEA;AAAA,OACOA,OAAO;AAAA,OACPC,aAAa;AAAA,OACbC,UAAU,sCAEjB;AAAA,OACOC,IAAI,2BAEX;AAAA,SACSC,WA
|