"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a=require("element-plus");require("../../../confirm-button/index.js");require("../../../count-down-button/index.js");const v=require("../../../ellipsis/index.js");require("../../../rich-text-editor/index.js");require("../../index.js");require("../../../pro-form/index.js");require("../../../pro-table/index.js");require("../../../pro-descriptions/index.js");require("../../../layout/index.js");require("../../../page/index.js");require("../../../guide/index.js");const C=require("./types.js"),g=e.createElementVNode("div",null,"-",-1),I=e.createElementVNode("div",{style:{padding:"0 8px"}},"-",-1),q={style:{"text-align":"right"}},y=e.defineComponent({__name:"index",props:C.digitRangeProps,emits:["update:modelValue","change"],setup(V,{emit:x}){const f=x,n=a.useNamespace("digitrange"),p=a.useNamespace("input"),r=V,s=e.shallowRef(),d=e.shallowRef(),c=e.shallowRef(!1),i=e.ref([]),N=e.computed(()=>typeof r.suffixIcon=="string"?e.h("span",{},{default:()=>r.suffixIcon}):r.suffixIcon),h=e.computed(()=>typeof r.prefixIcon=="string"?e.h("span",{},{default:()=>r.prefixIcon}):r.prefixIcon),w={0:[{validator(o,l,t){var u;i.value[1]!==void 0&&(l>i.value[1]&&t(new Error("数值起点不能高于或等于数值终点")),(l===""||l===void 0)&&t(new Error("当前输入不能为空"))),l===""&&((u=s.value)==null||u.clearValidate()),t()}}],1:[{validator(o,l,t){var u;i.value[0]!==void 0&&(l<=i.value[0]&&t(new Error("数值终点不能低于或等于数值起点")),(l===""||l===void 0)&&t(new Error("当前输入不能为空"))),l===""&&((u=s.value)==null||u.clearValidate()),t()}}]},E=()=>{var l;if(r.disabled)return;c.value=!0;const o=(l=d.value)==null?void 0:l.querySelector(`.${p.e("wrapper")}`);o&&o.classList.add("is-focus")},m=()=>{var l;c.value=!1;const o=(l=d.value)==null?void 0:l.querySelector(`.${p.e("wrapper")}`);o&&o.classList.remove("is-focus")},_=async()=>{var o;await((o=s.value)==null?void 0:o.validate()),f("update:modelValue",i.value),f("change",i.value),m()};return(o,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(e.unref(a.ElPopover),{visible:c.value,width:350},{reference:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).b(),e.unref(n).is("disabled",r.disabled)]),onClick:E,ref_key:"inputdiv",ref:d},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).e("inner")])},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).e("inner-value"),"is-left"])},[e.createVNode(e.unref(v.TextEllipsis),null,{default:e.withCtx(()=>{var t;return[e.createTextVNode(e.toDisplayString((t=r.modelValue)==null?void 0:t[0]),1)]}),_:1})],2),g,e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).e("inner-value"),"is-right"])},[e.createVNode(e.unref(v.TextEllipsis),null,{default:e.withCtx(()=>{var t;return[e.createTextVNode(e.toDisplayString((t=r.modelValue)==null?void 0:t[1]),1)]}),_:1})],2)],2),e.createVNode(e.unref(a.ElInput),{disabled:r.disabled,style:{width:"100%"},placeholder:r.placeholder,"model-value":r.modelValue&&r.modelValue.length!==0?" ":"","suffix-icon":N.value,"prefix-icon":h.value,size:r.size},null,8,["disabled","placeholder","model-value","suffix-icon","prefix-icon","size"])],2)]),default:e.withCtx(()=>[e.createVNode(e.unref(a.ElForm),{ref_key:"formIns",ref:s,model:i.value,rules:w,class:e.normalizeClass([e.unref(n).e("popover-panel")])},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElFormItem),{prop:"0"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElInputNumber),{modelValue:i.value[0],"onUpdate:modelValue":l[0]||(l[0]=t=>i.value[0]=t)},null,8,["modelValue"])]),_:1}),e.createVNode(e.unref(a.ElFormItem),null,{default:e.withCtx(()=>[I]),_:1}),e.createVNode(e.unref(a.ElFormItem),{prop:"1"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElInputNumber),{modelValue:i.value[1],"onUpdate:modelValue":l[1]||(l[1]=t=>i.value[1]=t)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","class"]),e.createElementVNode("div",q,[e.createVNode(e.unref(a.ElButton),{onClick:m},{default:e.withCtx(()=>[e.createTextVNode("取消")]),_:1}),e.createVNode(e.unref(a.ElButton),{type:"primary",onClick:_},{default:e.withCtx(()=>[e.createTextVNode("确认")]),_:1})])]),_:1},8,["visible"])]))}});exports.default=y;
