"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),q=require("@aplus-frontend/antdv"),i=require("lodash-unified");require("../../render/index.js");require("../../config-provider/index.js");require("../../hooks/index.js");const C=require("../hooks/use-default-placeholder.js"),k=require("../hooks/use-read-mode-render.js"),I=require("../style/index.js"),R=require("./utils.js"),z=require("../../hooks/useControllableValue.js"),A=require("../../config-provider/hooks/use-namespace.js"),T=require("../../render/render.js"),w=e.defineComponent({name:"ApFieldTextArea",__name:"index",props:{mode:{default:"edit"},class:{},style:{},emptyText:{default:"--"},customReadMode:{},rows:{},autoSize:{type:[Boolean,Object]},onResize:{},onCompositionstart:{},onCompositionend:{},valueModifiers:{},size:{},value:{},name:{},type:{default:"text"},onFocus:{},onBlur:{},onChange:{},onInput:{},onKeydown:{},onKeyup:{},onMousedown:{},focused:{type:Boolean},hidden:{type:Boolean},disabled:{type:Boolean,default:void 0},prefixCls:{},id:{},readonly:{type:Boolean},autofocus:{type:Boolean},variant:{},autocomplete:{},placeholder:{},lazy:{type:Boolean,default:!0},maxlength:{},loading:{type:Boolean},bordered:{type:Boolean,default:!0},showCount:{type:[Boolean,Object]},htmlSize:{},onPressEnter:{},onMouseUp:{},onRawInput:{},"onUpdate:value":{},status:{},defaultValue:{},inputElement:{},triggerFocus:{},handleReset:{},clearIcon:{},allowClear:{type:Boolean,default:!0},beforeInput:{},code:{type:[Boolean,Object],default:!1}},emits:["update:value"],setup(n,{expose:p,emit:f}){const a=e.shallowRef(),t=n,m=e.computed(()=>i.omit(t,["onUpdate:value","value","beforeInput","emptyText"])),y=f,{value:o,updateValue:v}=z.useControllableValue(t,y),{renderer:g}=k.useReadModeRender(t,o),{b:x,m:s}=A.useNamespace("field-textarea"),u=I.default("field"),B=C.useDefaultPlaceholder("TextArea",t),h=e.computed(()=>{if(t.code)return t.code===!0?{language:"text"}:{language:t.code?.language??"text"}});function b(r){const l=r.target.value||"",d=t.beforeInput?t.beforeInput?.(l):l,c=a.value?.$el?.querySelector("textarea");c&&(c.value=d),v(d)}return p({focus:r=>{a.value?.focus(r)},blur:()=>{a.value?.blur()},resizableTextArea:e.computed(()=>a.value?.resizableTextArea)}),(r,l)=>n.mode==="read"?(e.openBlock(),e.createBlock(e.unref(T.default),{key:0,renderer:e.unref(g)},{default:e.withCtx(()=>[n.code?(e.openBlock(),e.createElementBlock("pre",{key:1,class:e.normalizeClass([e.unref(s)("code"),e.unref(u)])},[e.createElementVNode("code",null,e.toDisplayString(e.unref(R.languageFormat)(e.unref(o),h.value.language)),1)],2)):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass([e.unref(s)("read"),e.unref(u)])},e.toDisplayString(e.unref(i.isNil)(e.unref(o))||e.unref(o)===""?n.emptyText:e.unref(o)),3))]),_:1},8,["renderer"])):(e.openBlock(),e.createBlock(e.unref(q.Input).TextArea,e.mergeProps({key:1},m.value,{ref_key:"textAreaRef",ref:a,placeholder:e.unref(B),value:e.unref(o),class:[e.unref(x)(),e.unref(u)],onInput:b}),null,16,["placeholder","value","class"]))}});exports.default=w;
