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

1 lines 8.92 kB
{"version":3,"file":"index.mjs","sources":["../../src/textarea/BaseTextarea.vue","../../src/textarea/Textarea.vue","../../src/textarea/Textarea.vue?vue&type=template&id=f8add878&lang.js"],"sourcesContent":["<script>\nimport BaseInput from '@primevue/core/baseinput';\nimport TextareaStyle from 'primevue/textarea/style';\n\nexport default {\n name: 'BaseTextarea',\n extends: BaseInput,\n props: {\n autoResize: Boolean\n },\n style: TextareaStyle,\n provide() {\n return {\n $pcTextarea: this,\n $parentInstance: this\n };\n }\n};\n</script>\n","<template>\n <textarea :class=\"cx('root')\" :value=\"d_value\" :name=\"name\" :disabled=\"disabled\" :aria-invalid=\"invalid || undefined\" :data-p=\"dataP\" @input=\"onInput\" v-bind=\"attrs\"></textarea>\n</template>\n\n<script>\nimport { cn } from '@primeuix/utils';\nimport { mergeProps } from 'vue';\nimport BaseTextarea from './BaseTextarea.vue';\n\nexport default {\n name: 'Textarea',\n extends: BaseTextarea,\n inheritAttrs: false,\n observer: null,\n mounted() {\n if (this.autoResize) {\n this.observer = new ResizeObserver(() => {\n // Firefox has issues without the requestAnimationFrame - ResizeObserver loop completed with undelivered notifications.\n requestAnimationFrame(() => {\n this.resize();\n });\n });\n this.observer.observe(this.$el);\n }\n },\n updated() {\n if (this.autoResize) {\n this.resize();\n }\n },\n beforeUnmount() {\n if (this.observer) {\n this.observer.disconnect();\n }\n },\n methods: {\n resize() {\n if (!this.$el.offsetParent) return;\n\n this.$el.style.height = 'auto';\n this.$el.style.height = this.$el.scrollHeight + 'px';\n\n if (parseFloat(this.$el.style.height) >= parseFloat(this.$el.style.maxHeight)) {\n this.$el.style.overflowY = 'scroll';\n this.$el.style.height = this.$el.style.maxHeight;\n } else {\n this.$el.style.overflow = 'hidden';\n }\n },\n onInput(event) {\n if (this.autoResize) {\n this.resize();\n }\n\n this.writeValue(event.target.value, event);\n }\n },\n computed: {\n attrs() {\n return mergeProps(\n this.ptmi('root', {\n context: {\n filled: this.$filled,\n disabled: this.disabled\n }\n }),\n this.formField\n );\n },\n dataP() {\n return cn({\n invalid: this.$invalid,\n fluid: this.$fluid,\n filled: this.$variant === 'filled',\n [this.size]: this.size\n });\n }\n }\n};\n</script>\n","<template>\n <textarea :class=\"cx('root')\" :value=\"d_value\" :name=\"name\" :disabled=\"disabled\" :aria-invalid=\"invalid || undefined\" :data-p=\"dataP\" @input=\"onInput\" v-bind=\"attrs\"></textarea>\n</template>\n\n<script>\nimport { cn } from '@primeuix/utils';\nimport { mergeProps } from 'vue';\nimport BaseTextarea from './BaseTextarea.vue';\n\nexport default {\n name: 'Textarea',\n extends: BaseTextarea,\n inheritAttrs: false,\n observer: null,\n mounted() {\n if (this.autoResize) {\n this.observer = new ResizeObserver(() => {\n // Firefox has issues without the requestAnimationFrame - ResizeObserver loop completed with undelivered notifications.\n requestAnimationFrame(() => {\n this.resize();\n });\n });\n this.observer.observe(this.$el);\n }\n },\n updated() {\n if (this.autoResize) {\n this.resize();\n }\n },\n beforeUnmount() {\n if (this.observer) {\n this.observer.disconnect();\n }\n },\n methods: {\n resize() {\n if (!this.$el.offsetParent) return;\n\n this.$el.style.height = 'auto';\n this.$el.style.height = this.$el.scrollHeight + 'px';\n\n if (parseFloat(this.$el.style.height) >= parseFloat(this.$el.style.maxHeight)) {\n this.$el.style.overflowY = 'scroll';\n this.$el.style.height = this.$el.style.maxHeight;\n } else {\n this.$el.style.overflow = 'hidden';\n }\n },\n onInput(event) {\n if (this.autoResize) {\n this.resize();\n }\n\n this.writeValue(event.target.value, event);\n }\n },\n computed: {\n attrs() {\n return mergeProps(\n this.ptmi('root', {\n context: {\n filled: this.$filled,\n disabled: this.disabled\n }\n }),\n this.formField\n );\n },\n dataP() {\n return cn({\n invalid: this.$invalid,\n fluid: this.$fluid,\n filled: this.$variant === 'filled',\n [this.size]: this.size\n });\n }\n }\n};\n</script>\n"],"names":["name","BaseInput","props","autoResize","Boolean","style","TextareaStyle","provide","$pcTextarea","$parentInstance","BaseTextarea","inheritAttrs","observer","mounted","_this","ResizeObserver","requestAnimationFrame","resize","observe","$el","updated","beforeUnmount","disconnect","methods","offsetParent","height","scrollHeight","parseFloat","maxHeight","overflowY","overflow","onInput","event","writeValue","target","value","computed","attrs","mergeProps","ptmi","context","filled","$filled","disabled","formField","dataP","cn","_defineProperty","invalid","$invalid","fluid","$fluid","$variant","size","_openBlock","_createElementBlock","_mergeProps","_ctx","cx","d_value","undefined","$options","apply","arguments","_hoisted_1"],"mappings":";;;;;AAIA,eAAe;AACXA,EAAAA,IAAI,EAAE,cAAc;AACpB,EAAA,SAAA,EAASC,SAAS;AAClBC,EAAAA,KAAK,EAAE;AACHC,IAAAA,UAAU,EAAEC;GACf;AACDC,EAAAA,KAAK,EAAEC,aAAa;EACpBC,OAAO,EAAA,SAAPA,OAAOA,GAAG;IACN,OAAO;AACHC,MAAAA,WAAW,EAAE,IAAI;AACjBC,MAAAA,eAAe,EAAE;KACpB;AACL;AACJ,CAAC;;;;;;ACRD,aAAe;AACXT,EAAAA,IAAI,EAAE,UAAU;AAChB,EAAA,SAAA,EAASU,QAAY;AACrBC,EAAAA,YAAY,EAAE,KAAK;AACnBC,EAAAA,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAA,SAAPA,OAAOA,GAAG;AAAA,IAAA,IAAAC,KAAA,GAAA,IAAA;IACN,IAAI,IAAI,CAACX,UAAU,EAAE;AACjB,MAAA,IAAI,CAACS,QAAO,GAAI,IAAIG,cAAc,CAAC,YAAM;AACrC;AACAC,QAAAA,qBAAqB,CAAC,YAAM;UACxBF,KAAI,CAACG,MAAM,EAAE;AACjB,SAAC,CAAC;AACN,OAAC,CAAC;MACF,IAAI,CAACL,QAAQ,CAACM,OAAO,CAAC,IAAI,CAACC,GAAG,CAAC;AACnC;GACH;EACDC,OAAO,EAAA,SAAPA,OAAOA,G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