UNPKG

primevue

Version:

PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc

89 lines (80 loc) 2.44 kB
'use strict'; var BaseComponent = require('primevue/basecomponent'); var TextareaStyle = require('primevue/textarea/style'); var vue = require('vue'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent); var TextareaStyle__default = /*#__PURE__*/_interopDefaultLegacy(TextareaStyle); var script$1 = { name: 'BaseTextarea', "extends": BaseComponent__default["default"], props: { modelValue: null, autoResize: Boolean }, style: TextareaStyle__default["default"], provide: function provide() { return { $parentInstance: this }; } }; var script = { name: 'Textarea', "extends": script$1, emits: ['update:modelValue'], mounted: function mounted() { if (this.$el.offsetParent && this.autoResize) { this.resize(); } }, updated: function updated() { if (this.$el.offsetParent && this.autoResize) { this.resize(); } }, methods: { resize: function resize() { this.$el.style.height = 'auto'; this.$el.style.height = this.$el.scrollHeight + 'px'; if (parseFloat(this.$el.style.height) >= parseFloat(this.$el.style.maxHeight)) { this.$el.style.overflowY = 'scroll'; this.$el.style.height = this.$el.style.maxHeight; } else { this.$el.style.overflow = 'hidden'; } }, onInput: function onInput(event) { if (this.autoResize) { this.resize(); } this.$emit('update:modelValue', event.target.value); } }, computed: { filled: function filled() { return this.modelValue != null && this.modelValue.toString().length > 0; }, ptmParams: function ptmParams() { return { context: { disabled: this.$attrs.disabled || this.$attrs.disabled === '' } }; } } }; var _hoisted_1 = ["value"]; function render(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("textarea", vue.mergeProps({ "class": _ctx.cx('root'), value: _ctx.modelValue, onInput: _cache[0] || (_cache[0] = function () { return $options.onInput && $options.onInput.apply($options, arguments); }) }, _ctx.ptm('root', $options.ptmParams), { "data-pc-name": "textarea" }), null, 16, _hoisted_1); } script.render = render; module.exports = script;