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,aAAO,KAAK,OAAL,CAAa,QAAb,EAAuB,OAAvB,EAAgC,IAAhC,CAAP;AACD,KAlJM;AAmJP,IAAA,OAnJO,mBAmJE,CAnJF,EAmJU;AACf,WAAK,KAAL,CAAW,OAAX,EAAoB,CAApB;AACD,KArJM;AAsJP,IAAA,WAtJO,uBAsJM,CAtJN,EAsJc;AACnB,WAAK,YAAL,GAAoB,IAApB;AACA,WAAK,KAAL,CAAW,WAAX,EAAwB,CAAxB;AACD,KAzJM;AA0JP,IAAA,SA1JO,qBA0JI,CA1JJ,EA0JY;AACjB,WAAK,YAAL,GAAoB,KAApB;AACA,WAAK,KAAL,CAAW,SAAX,EAAsB,CAAtB;AACD;AA7JM,GA1FwC;AA0PjD,EAAA,MA1PiD,kBA0PzC,CA1PyC,EA0PxC;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,C","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"} |