UNPKG

tdesign-pro-component

Version:

ProComponents tdesign-vue-next + Vue3 + TS

90 lines (89 loc) 2.62 kB
import { a as g, w as V } from "./utils-DU1amZow.js"; import { defineComponent as k, ref as P, onMounted as w, resolveComponent as r, openBlock as B, createBlock as v, mergeProps as u, withCtx as K, createVNode as C, unref as F, isRef as z } from "vue"; import { u as A } from "./hooks-9GWkbKry.js"; const R = /* @__PURE__ */ k({ name: "ProFormTextarea", __name: "ProFormTextarea", props: { name: {}, modelValue: {}, label: {}, placeholder: {}, autofocus: { type: Boolean }, disabled: { type: Boolean }, readonly: { type: Boolean }, size: {}, textareaProps: {}, labelWidth: {}, labelAlign: { default: "left" }, requiredMark: { type: Boolean }, rules: {}, formItemProps: {} }, emits: ["update:modelValue", "blur", "change", "focus", "keydown", "keypress", "keyup"], setup(s, { expose: d, emit: m }) { const e = s, a = m, n = A(e, "modelValue", a, e.modelValue || ""), t = P(); w(() => { e.name || g("name is empty"); }); function i(l, o) { a("blur", l, o); } function p(l, o) { a("change", l, o); } function c(l, o) { a("focus", l, o); } function f(l, o) { a("keydown", l, o); } function y(l, o) { a("keypress", l, o); } function b(l, o) { a("keyup", l, o); } return d({ clear: () => n.value = "", focus: () => t.value.focus(), getRef: () => t.value, blur: () => t.value.blur(), getValue: () => n.value }), (l, o) => { const h = r("t-textarea"), x = r("t-form-item"); return B(), v(x, u({ label: e.label, name: e.name, rules: e.rules, labelWidth: e.labelWidth, labelAlign: e.labelAlign }, e.formItemProps), { default: K(() => [ C(h, u({ ref_key: "textareaRef", ref: t, modelValue: F(n), "onUpdate:modelValue": o[0] || (o[0] = (_) => z(n) ? n.value = _ : null), disabled: e.disabled, size: e.size, readonly: e.readonly, placeholder: e.placeholder || `请输入${e.label || "数据"}`, autofocus: e.autofocus }, e.textareaProps, { onBlur: i, onChange: p, onFocus: c, onKeydown: f, onKeypress: y, onKeyup: b }), null, 16, ["modelValue", "disabled", "size", "readonly", "placeholder", "autofocus"]) ]), _: 1 }, 16, ["label", "name", "rules", "labelWidth", "labelAlign"]); }; } }), T = V(R); export { T as P };