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AAI,CAAC,IAAL,CAAU,KAAK,MAAL,CAAY,MAAtB;AACD,OAFD,MAEO,IAAI,KAAK,UAAT,EAAqB;AAC1B,QAAA,IAAI,CAAC,IAAL,CAAU,KAAK,OAAL,CAAa,QAAb,CAAV;AACD;;AAED,aAAO,KAAK,OAAL,CAAa,QAAb,EAAuB,OAAvB,EAAgC,IAAhC,CAAP;AACD,KAlJM;;AAmJP,IAAA,OAAO,CAAE,CAAF,EAAU;AACf,WAAK,KAAL,CAAW,OAAX,EAAoB,CAApB;AACD,KArJM;;AAsJP,IAAA,WAAW,CAAE,CAAF,EAAU;AACnB,WAAK,YAAL,GAAoB,IAApB;AACA,WAAK,KAAL,CAAW,WAAX,EAAwB,CAAxB;AACD,KAzJM;;AA0JP,IAAA,SAAS,CAAE,CAAF,EAAU;AACjB,WAAK,YAAL,GAAoB,KAApB;AACA,WAAK,KAAL,CAAW,SAAX,EAAsB,CAAtB;AACD;;AA7JM,GA1FwC;;AA0PjD,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,WAAO,CAAC,CAAC,KAAD,EAAQ,KAAK,YAAL,CAAkB,KAAK,eAAvB,EAAwC;AACtD,MAAA,WAAW,EAAE,SADyC;AAEtD,MAAA,KAAK,EAAE,KAAK;AAF0C,KAAxC,CAAR,EAGJ,KAAK,UAAL,EAHI,CAAR;AAID;;AA/PgD,CAApC,CAAf","sourcesContent":["// Styles\nimport './VInput.sass'\n\n// Components\nimport VIcon from '../VIcon'\nimport VLabel from '../VLabel'\nimport VMessages from '../VMessages'\n\n// Mixins\nimport Validatable from '../../mixins/validatable'\n\n// Utilities\nimport {\n convertToUnit,\n kebabCase,\n} from '../../util/helpers'\n\n// Types\nimport { VNode, VNodeData, PropType } from 'vue'\nimport mixins from '../../util/mixins'\n\nconst baseMixins = mixins(\n Validatable\n)\n\ninterface options extends InstanceType<typeof baseMixins> {\n /* eslint-disable-next-line camelcase */\n $_modelEvent: string\n}\n\n/* @vue/component */\nexport default baseMixins.extend<options>().extend({\n name: 'v-input',\n\n inheritAttrs: false,\n\n props: {\n appendIcon: String,\n backgroundColor: {\n type: String,\n default: '',\n },\n height: [Number, String],\n hideDetails: Boolean,\n hint: String,\n id: String,\n label: String,\n loading: Boolean,\n persistentHint: Boolean,\n prependIcon: String,\n value: null as any as PropType<any>,\n },\n\n data () {\n return {\n lazyValue: this.value,\n hasMouseDown: false,\n }\n },\n\n computed: {\n classes (): object {\n return {\n 'v-input--has-state': this.hasState,\n 'v-input--hide-details': this.hideDetails,\n 'v-input--is-label-active': this.isLabelActive,\n 'v-input--is-dirty': this.isDirty,\n 'v-input--is-disabled': this.disabled,\n 'v-input--is-focused': this.isFocused,\n 'v-input--is-loading': this.loading !== false && this.loading !== undefined,\n 'v-input--is-readonly': this.readonly,\n ...this.themeClasses,\n }\n },\n computedId (): string {\n return this.id || `input-${this._uid}`\n },\n hasHint (): boolean {\n return !this.hasMessages &&\n !!this.hint &&\n (this.persistentHint || this.isFocused)\n },\n hasLabel (): boolean {\n return !!(this.$slots.label || this.label)\n },\n // Proxy for `lazyValue`\n // This allows an input\n // to function without\n // a provided model\n internalValue: {\n get (): any {\n return this.lazyValue\n },\n set (val: any) {\n this.lazyValue = val\n this.$emit(this.$_modelEvent, val)\n },\n },\n isDirty (): boolean {\n return !!this.lazyValue\n },\n isDisabled (): boolean {\n return this.disabled || this.readonly\n },\n isLabelActive (): boolean {\n return this.isDirty\n },\n },\n\n watch: {\n value (val) {\n this.lazyValue = val\n },\n },\n\n beforeCreate () {\n // v-radio-group needs to emit a different event\n // https://github.com/vuetifyjs/vuetify/issues/4752\n this.$_modelEvent = (this.$options.model && this.$options.model.event) || 'input'\n },\n\n methods: {\n genContent () {\n return [\n this.genPrependSlot(),\n this.genControl(),\n this.genAppendSlot(),\n ]\n },\n genControl () {\n return this.$createElement('div', {\n staticClass: 'v-input__control',\n }, [\n this.genInputSlot(),\n this.genMessages(),\n ])\n },\n genDefaultSlot () {\n return [\n this.genLabel(),\n this.$slots.default,\n ]\n },\n genIcon (\n type: string,\n cb?: (e: Event) => void\n ) {\n const icon = (this as any)[`${type}Icon`]\n const eventName = `click:${kebabCase(type)}`\n\n const data: VNodeData = {\n props: {\n color: this.validationState,\n dark: this.dark,\n disabled: this.disabled,\n light: this.light,\n },\n on: !(this.$listeners[eventName] || cb)\n ? undefined\n : {\n click: (e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.$emit(eventName, e)\n cb && cb(e)\n },\n // Container has g event that will\n // trigger menu open if enclosed\n mouseup: (e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n },\n },\n }\n\n return this.$createElement('div', {\n staticClass: `v-input__icon v-input__icon--${kebabCase(type)}`,\n key: type + icon,\n }, [\n this.$createElement(\n VIcon,\n data,\n icon\n ),\n ])\n },\n genInputSlot () {\n return this.$createElement('div', this.setBackgroundColor(this.backgroundColor, {\n staticClass: 'v-input__slot',\n style: { height: convertToUnit(this.height) },\n on: {\n click: this.onClick,\n mousedown: this.onMouseDown,\n mouseup: this.onMouseUp,\n },\n ref: 'input-slot',\n }), [this.genDefaultSlot()])\n },\n genLabel () {\n if (!this.hasLabel) return null\n\n return this.$createElement(VLabel, {\n props: {\n color: this.validationState,\n dark: this.dark,\n focused: this.hasState,\n for: this.computedId,\n light: this.light,\n },\n }, this.$slots.label || this.label)\n },\n genMessages () {\n if (this.hideDetails) return null\n\n const messages = this.hasHint\n ? [this.hint]\n : this.validations\n\n return this.$createElement(VMessages, {\n props: {\n color: this.hasHint ? '' : this.validationState,\n dark: this.dark,\n light: this.light,\n value: (this.hasMessages || this.hasHint) ? messages : [],\n },\n })\n },\n genSlot (\n type: string,\n location: string,\n slot: (VNode | VNode[])[]\n ) {\n if (!slot.length) return null\n\n const ref = `${type}-${location}`\n\n return this.$createElement('div', {\n staticClass: `v-input__${ref}`,\n ref,\n }, slot)\n },\n genPrependSlot () {\n const slot = []\n\n if (this.$slots.prepend) {\n slot.push(this.$slots.prepend)\n } else if (this.prependIcon) {\n slot.push(this.genIcon('prepend'))\n }\n\n return this.genSlot('prepend', 'outer', slot)\n },\n genAppendSlot () {\n const slot = []\n\n // Append icon for text field was really\n // an appended inner icon, v-text-field\n // will overwrite this method in order to obtain\n // backwards compat\n if (this.$slots.append) {\n slot.push(this.$slots.append)\n } else if (this.appendIcon) {\n slot.push(this.genIcon('append'))\n }\n\n return this.genSlot('append', 'outer', slot)\n },\n onClick (e: Event) {\n this.$emit('click', e)\n },\n onMouseDown (e: Event) {\n this.hasMouseDown = true\n this.$emit('mousedown', e)\n },\n onMouseUp (e: Event) {\n this.hasMouseDown = false\n this.$emit('mouseup', e)\n },\n },\n\n render (h): VNode {\n return h('div', this.setTextColor(this.validationState, {\n staticClass: 'v-input',\n class: this.classes,\n }), this.genContent())\n },\n})\n"],"sourceRoot":"","file":"VInput.js"} |