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;AACD;AAED,iBAAK,cAAL,GAAsB,IAAtB;AACA,iBAAK,KAAL,CAAW,SAAX,EAAsB,CAAtB;AACD;AArCM;AA7DI,CAAf","sourcesContent":["// Styles\nimport '../../stylus/components/_textarea.styl'\n\n// Extensions\nimport VTextField from '../VTextField/VTextField'\n\nimport { consoleInfo } from '../../util/console'\n\n/* @vue/component */\nexport default {\n name: 'v-textarea',\n\n extends: VTextField,\n\n props: {\n autoGrow: Boolean,\n noResize: Boolean,\n outline: Boolean,\n rowHeight: {\n type: [Number, String],\n default: 24,\n validator: v => !isNaN(parseFloat(v))\n },\n rows: {\n type: [Number, String],\n default: 5,\n validator: v => !isNaN(parseInt(v, 10))\n }\n },\n\n computed: {\n classes () {\n return {\n 'v-textarea': true,\n 'v-textarea--auto-grow': this.autoGrow,\n 'v-textarea--no-resize': this.noResizeHandle,\n ...VTextField.options.computed.classes.call(this, null)\n }\n },\n dynamicHeight () {\n return this.autoGrow\n ? this.inputHeight\n : 'auto'\n },\n isEnclosed () {\n return this.textarea ||\n VTextField.options.computed.isEnclosed.call(this)\n },\n noResizeHandle () {\n return this.noResize || this.autoGrow\n }\n },\n\n watch: {\n lazyValue () {\n !this.internalChange && this.autoGrow && this.$nextTick(this.calculateInputHeight)\n }\n },\n\n mounted () {\n setTimeout(() => {\n this.autoGrow && this.calculateInputHeight()\n }, 0)\n\n // TODO: remove (2.0)\n if (this.autoGrow && this.noResize) {\n consoleInfo('\"no-resize\" is now implied when using \"auto-grow\", and can be removed', this)\n }\n },\n\n methods: {\n calculateInputHeight () {\n const input = this.$refs.input\n if (input) {\n input.style.height = 0\n const height = input.scrollHeight\n const minHeight = parseInt(this.rows, 10) * parseFloat(this.rowHeight)\n // This has to be done ASAP, waiting for Vue\n // to update the DOM causes ugly layout jumping\n input.style.height = Math.max(minHeight, height) + 'px'\n }\n },\n genInput () {\n const input = VTextField.options.methods.genInput.call(this)\n\n input.tag = 'textarea'\n delete input.data.attrs.type\n input.data.attrs.rows = this.rows\n\n return input\n },\n onInput (e) {\n VTextField.options.methods.onInput.call(this, e)\n this.autoGrow && this.calculateInputHeight()\n },\n onKeyDown (e) {\n // Prevents closing of a\n // dialog when pressing\n // enter\n if (this.isFocused &&\n e.keyCode === 13\n ) {\n e.stopPropagation()\n }\n\n this.internalChange = true\n this.$emit('keydown', e)\n }\n }\n}\n"],"sourceRoot":""}
|