"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("@ant-design/icons-vue"),p=require("@aplus-frontend/antdv"),g=require("lodash-unified");require("../../render/index.js");require("../../hooks/index.js");const w=require("../hooks/use-default-placeholder.js"),P=require("../hooks/use-read-mode-render.js"),c=require("../../hooks/useControllableValue.js"),R=require("../../render/render.js"),V={key:0},q=e.defineComponent({name:"ApFieldTextPassword",__name:"password",props:{mode:{default:"edit"},class:{},style:{},emptyText:{default:"--"},customReadMode:{},variant:{},size:{},value:{},name:{},type:{default:"text"},onCompositionend:{},onCompositionstart:{},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},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":{},valueModifiers:{},status:{},defaultValue:{},inputElement:{},triggerFocus:{},handleReset:{},addonBefore:{},addonAfter:{},prefix:{},suffix:{},clearIcon:{},allowClear:{type:Boolean,default:!0},inputPrefixCls:{},action:{default:"click"},visibilityToggle:{type:Boolean,default:!0},visible:{type:Boolean,default:void 0},"onUpdate:visible":{}},emits:["update:value","update:visible"],setup(l,{expose:f,emit:v}){const y=e.useSlots(),r=v,o=l,a=e.shallowRef(),{value:t,updateValue:m}=c.useControllableValue(o,r),{renderer:b}=P.useReadModeRender(o,t),B=w.useDefaultPlaceholder("TextPassword",o),{value:n,updateValue:u}=c.useControllableValue(o,r,{valuePropName:"visible"}),k=e.computed(()=>g.omit(o,["mode","emptyText","value","onUpdate:value","visible","onUpdate:visible"]));return f({focus:()=>{a.value?.focus()},blur:()=>{a.value?.blur()}}),(h,s)=>l.mode==="edit"?(e.openBlock(),e.createBlock(e.unref(p.Input).Password,e.mergeProps({key:0},k.value,{ref_key:"inputRef",ref:a,placeholder:e.unref(B),value:e.unref(t),visible:e.unref(n),"onUpdate:value":e.unref(m),"onUpdate:visible":e.unref(u)}),e.createSlots({_:2},[e.renderList(y,(x,d)=>({name:d,fn:e.withCtx(C=>[e.renderSlot(h.$slots,d,e.normalizeProps(e.guardReactiveProps(C||{})))])}))]),1040,["placeholder","value","visible","onUpdate:value","onUpdate:visible"])):(e.openBlock(),e.createBlock(e.unref(R.default),{key:1,renderer:e.unref(b)},{default:e.withCtx(()=>[e.unref(t)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",V,e.toDisplayString(l.emptyText),1)),e.createVNode(e.unref(p.Flex),{gap:8,align:"center"},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(e.unref(n)?e.unref(t):"********"),1),e.createElementVNode("span",{style:{cursor:"pointer"},onClick:s[0]||(s[0]=x=>e.unref(u)(!e.unref(n)))},[e.unref(n)?(e.openBlock(),e.createBlock(e.unref(i.EyeOutlined),{key:0})):(e.openBlock(),e.createBlock(e.unref(i.EyeInvisibleOutlined),{key:1}))])]),_:1})]),_:1},8,["renderer"]))}});exports.default=q;
