@macrulez/vue-form-schema 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +461 -180
- package/dist/MaskEngine-BEXwX4BK.js +144 -0
- package/dist/MaskEngine-CPr-fSPy.cjs +1 -0
- package/dist/ValidationEngine-BC4U1ef1.js +135 -0
- package/dist/ValidationEngine-Diz-qTFs.cjs +1 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/core/ConditionEvaluator.d.ts.map +1 -1
- package/dist/core/MaskEngine.d.ts.map +1 -1
- package/dist/core/ValidationEngine.d.ts +13 -0
- package/dist/core/ValidationEngine.d.ts.map +1 -1
- package/dist/core/formRegistry.d.ts +33 -0
- package/dist/core/formRegistry.d.ts.map +1 -0
- package/dist/core/inferTypes.d.ts.map +1 -1
- package/dist/core/schemaUtils.d.ts +38 -0
- package/dist/core/schemaUtils.d.ts.map +1 -1
- package/dist/core/serverErrors.d.ts +69 -0
- package/dist/core/serverErrors.d.ts.map +1 -0
- package/dist/core/types.d.ts +22 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/useForm.d.ts +4 -1
- package/dist/core/useForm.d.ts.map +1 -1
- package/dist/core/useMultiStepForm.d.ts.map +1 -1
- package/dist/devtools/index.d.ts +26 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools.cjs +1 -0
- package/dist/devtools.d.ts +6 -0
- package/dist/devtools.js +93 -0
- package/dist/formRegistry-Bv1eaWQ-.js +31 -0
- package/dist/formRegistry-DaDmXyYY.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +392 -359
- package/dist/openapi.cjs +1 -0
- package/dist/openapi.d.ts +202 -0
- package/dist/openapi.js +118 -0
- package/dist/parsers/json.d.ts.map +1 -1
- package/dist/parsers/openapi.d.ts +139 -0
- package/dist/parsers/openapi.d.ts.map +1 -0
- package/dist/parsers/valibot.d.ts +13 -4
- package/dist/parsers/valibot.d.ts.map +1 -1
- package/dist/parsers/yup.d.ts +10 -4
- package/dist/parsers/yup.d.ts.map +1 -1
- package/dist/parsers/zod.d.ts +18 -4
- package/dist/parsers/zod.d.ts.map +1 -1
- package/dist/schemaUtils-Cc7CwGXB.cjs +1 -0
- package/dist/schemaUtils-Cvlsk24U.js +337 -0
- package/dist/style.css +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/naive/index.d.ts +11 -0
- package/dist/ui/naive/index.d.ts.map +1 -0
- package/dist/ui/primevue/index.d.ts +11 -0
- package/dist/ui/primevue/index.d.ts.map +1 -0
- package/dist/ui/shadcn/index.d.ts +11 -0
- package/dist/ui/shadcn/index.d.ts.map +1 -0
- package/dist/ui/tailwind/index.d.ts +11 -0
- package/dist/ui/tailwind/index.d.ts.map +1 -0
- package/dist/ui-naive.cjs +1 -0
- package/dist/ui-naive.d.ts +411 -0
- package/dist/ui-naive.js +667 -0
- package/dist/ui-primevue.cjs +1 -0
- package/dist/ui-primevue.d.ts +411 -0
- package/dist/ui-primevue.js +651 -0
- package/dist/ui-shadcn.cjs +1 -0
- package/dist/ui-shadcn.d.ts +411 -0
- package/dist/ui-shadcn.js +650 -0
- package/dist/ui-tailwind.cjs +1 -0
- package/dist/ui-tailwind.d.ts +411 -0
- package/dist/ui-tailwind.js +669 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +61 -10
- package/dist/ui.js +434 -299
- package/dist/valibot.cjs +1 -1
- package/dist/valibot.d.ts +35 -4
- package/dist/valibot.js +47 -20
- package/dist/yup.cjs +1 -1
- package/dist/yup.d.ts +33 -5
- package/dist/yup.js +16 -15
- package/dist/zod.cjs +1 -1
- package/dist/zod.d.ts +41 -5
- package/dist/zod.js +58 -28
- package/package.json +99 -25
- package/dist/MaskEngine-BqJQYybS.js +0 -233
- package/dist/MaskEngine-BwAs2Zb0.cjs +0 -1
- package/dist/__tests__/ConditionEvaluator.test.d.ts +0 -2
- package/dist/__tests__/ConditionEvaluator.test.d.ts.map +0 -1
- package/dist/__tests__/MaskEngine.test.d.ts +0 -2
- package/dist/__tests__/MaskEngine.test.d.ts.map +0 -1
- package/dist/__tests__/ValidationEngine.test.d.ts +0 -2
- package/dist/__tests__/ValidationEngine.test.d.ts.map +0 -1
- package/dist/__tests__/parsers.test.d.ts +0 -2
- package/dist/__tests__/parsers.test.d.ts.map +0 -1
- package/dist/__tests__/phase3.test.d.ts +0 -2
- package/dist/__tests__/phase3.test.d.ts.map +0 -1
- package/dist/__tests__/phase4.test.d.ts +0 -2
- package/dist/__tests__/phase4.test.d.ts.map +0 -1
- package/dist/__tests__/useFieldArray.test.d.ts +0 -2
- package/dist/__tests__/useFieldArray.test.d.ts.map +0 -1
- package/dist/__tests__/useForm.test.d.ts +0 -2
- package/dist/__tests__/useForm.test.d.ts.map +0 -1
- package/dist/__tests__/useMultiStepForm.test.d.ts +0 -2
- package/dist/__tests__/useMultiStepForm.test.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),x=require("primevue/button"),g=require("./MaskEngine-CPr-fSPy.cjs"),q=require("./ValidationEngine-Diz-qTFs.cjs"),R=require("primevue/inputtext"),z=require("primevue/message"),w=require("primevue/inputnumber"),T=require("primevue/textarea"),A=require("primevue/select"),U=require("primevue/checkbox"),I=require("primevue/radiobutton"),L=require("primevue/datepicker"),M=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j={class:"mb-4 flex flex-col gap-1.5"},H=["for"],K={key:0,class:"ml-0.5 text-red-500","aria-hidden":"true"},O=["id"],b=e.defineComponent({__name:"BaseField",props:{field:{},error:{},touched:{type:Boolean}},setup(t){const i=t,o=e.computed(()=>{var c;return!!(i.touched&&((c=i.error)!=null&&c.length))}),s=e.computed(()=>`${i.field.name}-error`),n=e.computed(()=>({invalid:o.value,"aria-required":i.field.required?"true":void 0,"aria-invalid":o.value?"true":"false","aria-describedby":o.value?s.value:void 0}));return(c,u)=>(e.openBlock(),e.createElementBlock("div",j,[t.field.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.field.name,class:"text-sm font-medium"},[e.createTextVNode(e.toDisplayString(t.field.label)+" ",1),t.field.required?(e.openBlock(),e.createElementBlock("span",K,"*")):e.createCommentVNode("",!0)],8,H)):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",e.normalizeProps(e.guardReactiveProps(n.value))),o.value?(e.openBlock(),e.createElementBlock("div",{key:1,id:s.value,role:"alert","aria-live":"polite",class:"flex flex-col gap-1"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.error,(d,m)=>(e.openBlock(),e.createBlock(e.unref(z),{key:m,severity:"error",size:"small",variant:"simple"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d),1)]),_:2},1024))),128))],8,O)):e.createCommentVNode("",!0)]))}}),h=e.defineComponent({__name:"TextField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.ref(null);let c=null;return e.onMounted(()=>{var d;const u=(d=n.value)==null?void 0:d.$el;u&&o.field.mask&&(c=g.bindMask(u,o.field.mask))}),e.onUnmounted(()=>c==null?void 0:c()),(u,d)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(m=>[e.createVNode(e.unref(R),e.mergeProps({id:t.field.name,ref_key:"inputRef",ref:n,type:t.field.type==="email"?"email":"text",name:t.field.name,"model-value":t.modelValue??"",placeholder:t.field.placeholder,disabled:t.field.disabled===!0,required:t.field.required,fluid:""},m,{"onUpdate:modelValue":d[0]||(d[0]=f=>s("update:modelValue",f??"")),onBlur:d[1]||(d[1]=f=>s("blur"))}),null,16,["id","type","name","model-value","placeholder","disabled","required"])]),_:1},8,["field","error","touched"]))}}),$=e.defineComponent({__name:"NumberField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=i;return(s,n)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(c=>[e.createVNode(e.unref(w),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":t.modelValue,placeholder:t.field.placeholder,disabled:t.field.disabled===!0,fluid:""},c,{"onUpdate:modelValue":n[0]||(n[0]=u=>o("update:modelValue",u)),onBlur:n[1]||(n[1]=u=>o("blur"))}),null,16,["input-id","name","model-value","placeholder","disabled"])]),_:1},8,["field","error","touched"]))}}),C=e.defineComponent({__name:"TextareaField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=i;return(s,n)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(c=>[e.createVNode(e.unref(T),e.mergeProps({id:t.field.name,name:t.field.name,"model-value":t.modelValue??"",placeholder:t.field.placeholder,disabled:t.field.disabled===!0,required:t.field.required,rows:"3",fluid:""},c,{"onUpdate:modelValue":n[0]||(n[0]=u=>o("update:modelValue",u)),onBlur:n[1]||(n[1]=u=>o("blur"))}),null,16,["id","name","model-value","placeholder","disabled","required"])]),_:1},8,["field","error","touched"]))}}),E=e.defineComponent({__name:"SelectField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.computed(()=>Array.isArray(o.field.options)?o.field.options:[]);return(c,u)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(d=>[e.createVNode(e.unref(A),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":t.modelValue,options:n.value,"option-label":"label","option-value":"value",placeholder:t.field.placeholder??"Select an option",disabled:t.field.disabled===!0||t.field.optionsLoading,loading:t.field.optionsLoading,fluid:""},d,{"onUpdate:modelValue":u[0]||(u[0]=m=>s("update:modelValue",m)),onBlur:u[1]||(u[1]=m=>s("blur"))}),null,16,["input-id","name","model-value","options","placeholder","disabled","loading"])]),_:1},8,["field","error","touched"]))}}),Y={class:"flex cursor-pointer items-center gap-2.5"},G={key:0,class:"text-sm"},N=e.defineComponent({__name:"CheckboxField",props:{field:{},modelValue:{type:[Boolean,null]},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=i;return(s,n)=>(e.openBlock(),e.createBlock(b,{field:{...t.field,label:void 0},error:t.error,touched:t.touched},{default:e.withCtx(c=>[e.createElementVNode("label",Y,[e.createVNode(e.unref(U),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":!!t.modelValue,binary:"",disabled:t.field.disabled===!0},c,{"onUpdate:modelValue":n[0]||(n[0]=u=>o("update:modelValue",u)),onBlur:n[1]||(n[1]=u=>o("blur"))}),null,16,["input-id","name","model-value","disabled"]),t.field.label?(e.openBlock(),e.createElementBlock("span",G,e.toDisplayString(t.field.label),1)):e.createCommentVNode("",!0)])]),_:1},8,["field","error","touched"]))}}),J=["aria-required","aria-invalid","aria-describedby"],Q={key:0,class:"text-sm font-medium"},W={key:0,class:"ml-0.5 text-red-500","aria-hidden":"true"},X={class:"flex flex-col gap-2"},Z={class:"text-sm"},_=["id"],F=e.defineComponent({__name:"RadioField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.computed(()=>{var d;return!!(o.touched&&((d=o.error)!=null&&d.length))}),c=e.computed(()=>`${o.field.name}-error`),u=e.computed(()=>Array.isArray(o.field.options)?o.field.options:[]);return(d,m)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"mb-4 flex flex-col gap-2","aria-required":t.field.required?"true":void 0,"aria-invalid":n.value?"true":"false","aria-describedby":n.value?c.value:void 0},[t.field.label?(e.openBlock(),e.createElementBlock("legend",Q,[e.createTextVNode(e.toDisplayString(t.field.label)+" ",1),t.field.required?(e.openBlock(),e.createElementBlock("span",W,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,f=>(e.openBlock(),e.createElementBlock("label",{key:String(f.value),class:"flex cursor-pointer items-center gap-2.5"},[e.createVNode(e.unref(I),{name:t.field.name,value:f.value,"model-value":t.modelValue,disabled:t.field.disabled===!0,"onUpdate:modelValue":m[0]||(m[0]=k=>s("update:modelValue",k)),onBlur:m[1]||(m[1]=k=>s("blur"))},null,8,["name","value","model-value","disabled"]),e.createElementVNode("span",Z,e.toDisplayString(f.label),1)]))),128))]),n.value?(e.openBlock(),e.createElementBlock("div",{key:1,id:c.value,role:"alert","aria-live":"polite"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.error,(f,k)=>(e.openBlock(),e.createElementBlock("p",{key:k,class:"text-sm font-medium text-red-500"},e.toDisplayString(f),1))),128))],8,_)):e.createCommentVNode("",!0)],8,J))}}),S=e.defineComponent({__name:"DateField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i;function n(d){if(!d)return null;const[m,f,k]=d.split("-").map(Number);return!m||!f||!k?null:new Date(m,f-1,k)}function c(d){if(!(d instanceof Date))return"";const m=d.getFullYear(),f=String(d.getMonth()+1).padStart(2,"0"),k=String(d.getDate()).padStart(2,"0");return`${m}-${f}-${k}`}const u=e.computed(()=>n(o.modelValue));return(d,m)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(f=>[e.createVNode(e.unref(L),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":u.value,"date-format":"yy-mm-dd","show-icon":"","icon-display":"input",disabled:t.field.disabled===!0,fluid:""},f,{"onUpdate:modelValue":m[0]||(m[0]=k=>s("update:modelValue",c(k))),onBlur:m[1]||(m[1]=k=>s("blur"))}),null,16,["input-id","name","model-value","disabled"])]),_:1},8,["field","error","touched"]))}}),ee=["id","name","accept","multiple","disabled","required"],te={class:"vfs-pv-dropzone__hint"},le={key:0,class:"vfs-pv-dropzone__accept"},oe={key:0,class:"vfs-pv-filelist"},ne={class:"vfs-pv-filelist__name"},re={class:"vfs-pv-filelist__size"},ae=["aria-label","onClick"],de=e.defineComponent({__name:"FileField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.ref(!1),c=e.ref(null),u=e.computed(()=>o.modelValue?Array.isArray(o.modelValue)?o.modelValue:[o.modelValue]:[]),d=e.computed(()=>o.field.multiple??!1);function m(r){if(!r||r.length===0){s("update:modelValue",null);return}s("update:modelValue",d.value?Array.from(r):r[0])}function f(r){m(r.target.files),s("blur")}function k(r){var l;n.value=!1,r.preventDefault(),m(((l=r.dataTransfer)==null?void 0:l.files)??null),s("blur")}function V(r){const l=u.value.filter((p,v)=>v!==r);l.length===0?(s("update:modelValue",null),c.value&&(c.value.value="")):s("update:modelValue",d.value?l:l[0])}function y(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}return(r,l)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(p=>{var v;return[e.createElementVNode("div",{class:e.normalizeClass(["vfs-pv-dropzone",{"vfs-pv-dropzone--dragging":n.value,"vfs-pv-dropzone--error":t.touched&&((v=t.error)==null?void 0:v.length)}]),onDragover:l[0]||(l[0]=e.withModifiers(a=>n.value=!0,["prevent"])),onDragleave:l[1]||(l[1]=a=>n.value=!1),onDrop:k},[e.createElementVNode("input",e.mergeProps({id:t.field.name,ref_key:"inputRef",ref:c,type:"file",name:t.field.name,accept:t.field.accept,multiple:d.value,disabled:t.field.disabled===!0,required:t.field.required},p,{class:"vfs-pv-dropzone__input",onChange:f}),null,16,ee),e.createElementVNode("div",te,[e.createElementVNode("p",null,e.toDisplayString(n.value?"Drop files here":"Click to upload or drag & drop"),1),t.field.accept?(e.openBlock(),e.createElementBlock("p",le,e.toDisplayString(t.field.accept),1)):e.createCommentVNode("",!0)])],34),u.value.length?(e.openBlock(),e.createElementBlock("ul",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(a,B)=>(e.openBlock(),e.createElementBlock("li",{key:`${a.name}-${B}`,class:"vfs-pv-filelist__item"},[e.createElementVNode("span",ne,e.toDisplayString(a.name),1),e.createElementVNode("span",re,e.toDisplayString(y(a.size)),1),e.createElementVNode("button",{type:"button","aria-label":`Remove ${a.name}`,class:"vfs-pv-filelist__remove",onClick:pe=>V(B)}," × ",8,ae)]))),128))])):e.createCommentVNode("",!0)]}),_:1},8,["field","error","touched"]))}}),D=M._export_sfc(de,[["__scopeId","data-v-1fed53d8"]]),ie={class:"mb-4"},ue={key:0,class:"mb-2 text-sm font-medium"},ce={class:"flex-1"},P=e.defineComponent({__name:"ArrayField",props:{field:{},form:{},components:{}},setup(t){const i=t,o=g.useRegistry(),s={text:h,email:h,number:$,textarea:C,select:E,checkbox:N,radio:F,date:S};function n(r){var l;return r.component?r.component:((l=i.components)==null?void 0:l[r.type])??o[r.type]??s[r.type]??null}const{rows:c,append:u,remove:d}=g.useFieldArray(i.form,i.field.name);function m(r){return q.getByPath(i.form.values.value,r.name)}function f(r,l){i.form.setField(r.name,l)}function k(r){var p;const l=i.form;(p=l.touchField)==null||p.call(l,r.name)}function V(r){return i.form.errors.value[r.name]??[]}function y(r){return i.form.touched.value[r.name]??!1}return(r,l)=>(e.openBlock(),e.createElementBlock("div",ie,[t.field.label?(e.openBlock(),e.createElementBlock("div",ue,e.toDisplayString(t.field.label),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),p=>(e.openBlock(),e.createElementBlock("div",{key:p.key,style:{border:"1px solid var(--p-surface-200, #e2e8f0)"},class:"mb-2 flex items-start gap-2 rounded-md p-3"},[e.createElementVNode("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.fields,v=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v.name},[n(v)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(v)),{key:0,field:v,"model-value":m(v),error:V(v),touched:y(v),"onUpdate:modelValue":a=>f(v,a),onBlur:a=>k(v)},null,40,["field","model-value","error","touched","onUpdate:modelValue","onBlur"])):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(e.unref(x),{type:"button",label:"Remove",severity:"danger",text:"",size:"small",class:"mt-6",onClick:v=>e.unref(d)(p.index)},null,8,["onClick"])]))),128)),e.createVNode(e.unref(x),{type:"button",label:"+ Add row",severity:"secondary",text:"",size:"small",onClick:l[0]||(l[0]=p=>e.unref(u)())})]))}}),me={key:1,style:{border:"1px solid var(--p-surface-200, #e2e8f0)"},class:"mb-4 rounded-md p-4"},se={key:0,class:"px-1 text-sm font-medium"},fe=e.defineComponent({__name:"PrimeVueFormRenderer",props:{form:{},components:{},submitLabel:{},fields:{}},emits:["submit"],setup(t,{emit:i}){const o=t,s=g.useRegistry(),n=i,c={text:h,email:h,number:$,textarea:C,select:E,checkbox:N,radio:F,date:S,file:D};function u(l){var p;return l.component?l.component:((p=o.components)==null?void 0:p[l.type])??s[l.type]??c[l.type]??null}function d(l){return q.getByPath(o.form.values.value,l.name)}function m(l,p){o.form.setField(l.name,p)}function f(l){var v;const p=o.form;(v=p.touchField)==null||v.call(p,l.name)}function k(l){return o.form.errors.value[l.name]??[]}function V(l){return o.form.touched.value[l.name]??!1}const y=e.computed(()=>(o.fields??o.form.fields.value).filter(l=>l.visible!==!1));async function r(l){l.preventDefault(),await o.form.submit(),n("submit")}return(l,p)=>{const v=e.resolveComponent("PrimeVueFormRenderer",!0);return e.openBlock(),e.createElementBlock("form",{novalidate:"",onSubmit:r},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.name},[l.$slots[`field-${a.name}`]?e.renderSlot(l.$slots,`field-${a.name}`,{key:0,field:a,value:d(a),error:k(a),touched:V(a),setValue:B=>m(a,B),touch:()=>f(a)}):a.type==="group"?(e.openBlock(),e.createElementBlock("fieldset",me,[a.label?(e.openBlock(),e.createElementBlock("legend",se,e.toDisplayString(a.label),1)):e.createCommentVNode("",!0),a.fields?(e.openBlock(),e.createBlock(v,{key:1,form:t.form,fields:a.fields,components:t.components},null,8,["form","fields","components"])):e.createCommentVNode("",!0)])):a.type==="array"?(e.openBlock(),e.createBlock(P,{key:2,field:a,form:t.form,components:t.components},null,8,["field","form","components"])):u(a)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u(a)),{key:3,field:a,"model-value":d(a),error:k(a),touched:V(a),"onUpdate:modelValue":B=>m(a,B),onBlur:B=>f(a)},null,40,["field","model-value","error","touched","onUpdate:modelValue","onBlur"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(l.$slots,"submit",{isSubmitting:t.form.isSubmitting.value,isValid:t.form.isValid.value},()=>[e.createVNode(e.unref(x),{type:"submit",label:t.submitLabel??"Submit",disabled:t.form.isSubmitting.value,class:"mt-2"},null,8,["label","disabled"])])],32)}}});exports.PrimeVueFormRenderer=fe;exports.PvArrayField=P;exports.PvCheckboxField=N;exports.PvDateField=S;exports.PvFileField=D;exports.PvNumberField=$;exports.PvRadioField=F;exports.PvSelectField=E;exports.PvTextField=h;exports.PvTextareaField=C;
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
3
|
+
import { ComponentProvideOptions } from 'vue';
|
|
4
|
+
import { ComputedRef } from 'vue';
|
|
5
|
+
import { DefineComponent } from 'vue';
|
|
6
|
+
import { ExtractPropTypes } from 'vue';
|
|
7
|
+
import { PropType } from 'vue';
|
|
8
|
+
import { PublicProps } from 'vue';
|
|
9
|
+
import { Ref } from 'vue';
|
|
10
|
+
|
|
11
|
+
declare const __VLS_component: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
12
|
+
form: UseFormReturn;
|
|
13
|
+
components?: Partial<Record<FieldDefinition["type"], Component | string>>;
|
|
14
|
+
submitLabel?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Internal: the field list to render. Used by the `group` case to recurse
|
|
17
|
+
* into `field.fields` instead of re-rendering the whole top-level schema
|
|
18
|
+
* (which would recurse into the same group forever). Defaults to the
|
|
19
|
+
* form's top-level fields — not meant to be passed by consumers.
|
|
20
|
+
*/
|
|
21
|
+
fields?: FieldDefinition[];
|
|
22
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
23
|
+
submit: () => void;
|
|
24
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
25
|
+
form: UseFormReturn;
|
|
26
|
+
components?: Partial<Record<FieldDefinition["type"], Component | string>>;
|
|
27
|
+
submitLabel?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Internal: the field list to render. Used by the `group` case to recurse
|
|
30
|
+
* into `field.fields` instead of re-rendering the whole top-level schema
|
|
31
|
+
* (which would recurse into the same group forever). Defaults to the
|
|
32
|
+
* form's top-level fields — not meant to be passed by consumers.
|
|
33
|
+
*/
|
|
34
|
+
fields?: FieldDefinition[];
|
|
35
|
+
}>>> & Readonly<{
|
|
36
|
+
onSubmit?: (() => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
38
|
+
|
|
39
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
40
|
+
|
|
41
|
+
declare type __VLS_NonUndefinedable_10<T> = T extends undefined ? never : T;
|
|
42
|
+
|
|
43
|
+
declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
|
|
44
|
+
|
|
45
|
+
declare type __VLS_NonUndefinedable_3<T> = T extends undefined ? never : T;
|
|
46
|
+
|
|
47
|
+
declare type __VLS_NonUndefinedable_4<T> = T extends undefined ? never : T;
|
|
48
|
+
|
|
49
|
+
declare type __VLS_NonUndefinedable_5<T> = T extends undefined ? never : T;
|
|
50
|
+
|
|
51
|
+
declare type __VLS_NonUndefinedable_6<T> = T extends undefined ? never : T;
|
|
52
|
+
|
|
53
|
+
declare type __VLS_NonUndefinedable_7<T> = T extends undefined ? never : T;
|
|
54
|
+
|
|
55
|
+
declare type __VLS_NonUndefinedable_8<T> = T extends undefined ? never : T;
|
|
56
|
+
|
|
57
|
+
declare type __VLS_NonUndefinedable_9<T> = T extends undefined ? never : T;
|
|
58
|
+
|
|
59
|
+
declare function __VLS_template(): Partial<Record<`field-${string}`, (_: {
|
|
60
|
+
field: FieldDefinition;
|
|
61
|
+
value: unknown;
|
|
62
|
+
error: string[];
|
|
63
|
+
touched: boolean;
|
|
64
|
+
setValue: (v: unknown) => void;
|
|
65
|
+
touch: () => void;
|
|
66
|
+
}) => any>> & {
|
|
67
|
+
submit?(_: {
|
|
68
|
+
isSubmitting: boolean;
|
|
69
|
+
isValid: boolean;
|
|
70
|
+
}): any;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
74
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
75
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
76
|
+
} : {
|
|
77
|
+
type: PropType<T[K]>;
|
|
78
|
+
required: true;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
declare type __VLS_TypePropsToRuntimeProps_10<T> = {
|
|
83
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
84
|
+
type: PropType<__VLS_NonUndefinedable_10<T[K]>>;
|
|
85
|
+
} : {
|
|
86
|
+
type: PropType<T[K]>;
|
|
87
|
+
required: true;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
declare type __VLS_TypePropsToRuntimeProps_2<T> = {
|
|
92
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
93
|
+
type: PropType<__VLS_NonUndefinedable_2<T[K]>>;
|
|
94
|
+
} : {
|
|
95
|
+
type: PropType<T[K]>;
|
|
96
|
+
required: true;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
declare type __VLS_TypePropsToRuntimeProps_3<T> = {
|
|
101
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
102
|
+
type: PropType<__VLS_NonUndefinedable_3<T[K]>>;
|
|
103
|
+
} : {
|
|
104
|
+
type: PropType<T[K]>;
|
|
105
|
+
required: true;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
declare type __VLS_TypePropsToRuntimeProps_4<T> = {
|
|
110
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
111
|
+
type: PropType<__VLS_NonUndefinedable_4<T[K]>>;
|
|
112
|
+
} : {
|
|
113
|
+
type: PropType<T[K]>;
|
|
114
|
+
required: true;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare type __VLS_TypePropsToRuntimeProps_5<T> = {
|
|
119
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
120
|
+
type: PropType<__VLS_NonUndefinedable_5<T[K]>>;
|
|
121
|
+
} : {
|
|
122
|
+
type: PropType<T[K]>;
|
|
123
|
+
required: true;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
declare type __VLS_TypePropsToRuntimeProps_6<T> = {
|
|
128
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
129
|
+
type: PropType<__VLS_NonUndefinedable_6<T[K]>>;
|
|
130
|
+
} : {
|
|
131
|
+
type: PropType<T[K]>;
|
|
132
|
+
required: true;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
declare type __VLS_TypePropsToRuntimeProps_7<T> = {
|
|
137
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
138
|
+
type: PropType<__VLS_NonUndefinedable_7<T[K]>>;
|
|
139
|
+
} : {
|
|
140
|
+
type: PropType<T[K]>;
|
|
141
|
+
required: true;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare type __VLS_TypePropsToRuntimeProps_8<T> = {
|
|
146
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
147
|
+
type: PropType<__VLS_NonUndefinedable_8<T[K]>>;
|
|
148
|
+
} : {
|
|
149
|
+
type: PropType<T[K]>;
|
|
150
|
+
required: true;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
declare type __VLS_TypePropsToRuntimeProps_9<T> = {
|
|
155
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
156
|
+
type: PropType<__VLS_NonUndefinedable_9<T[K]>>;
|
|
157
|
+
} : {
|
|
158
|
+
type: PropType<T[K]>;
|
|
159
|
+
required: true;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
164
|
+
new (): {
|
|
165
|
+
$slots: S;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
declare type AsyncValidatorFn = (value: unknown, values: Record<string, unknown>) => Promise<string | null>;
|
|
170
|
+
|
|
171
|
+
declare interface FieldDefinition {
|
|
172
|
+
type: FieldType;
|
|
173
|
+
/** Dot-path for nested fields, e.g. "address.city" */
|
|
174
|
+
name: string;
|
|
175
|
+
label?: string;
|
|
176
|
+
placeholder?: string;
|
|
177
|
+
defaultValue?: unknown | ((values: Record<string, unknown>) => unknown);
|
|
178
|
+
required?: boolean;
|
|
179
|
+
/** Static or dynamic disabled state */
|
|
180
|
+
disabled?: boolean | ((values: Record<string, unknown>) => boolean);
|
|
181
|
+
/** Static or dynamic visibility; string is evaluated as expression */
|
|
182
|
+
visible?: boolean | string | ((values: Record<string, unknown>) => boolean);
|
|
183
|
+
validators?: ValidatorFn[];
|
|
184
|
+
asyncValidators?: AsyncValidatorFn[];
|
|
185
|
+
mask?: string | MaskConfig;
|
|
186
|
+
/** For select / radio — static list, sync function, or async function */
|
|
187
|
+
options?: FieldOption[] | ((values: Record<string, unknown>) => FieldOption[] | Promise<FieldOption[]>);
|
|
188
|
+
/**
|
|
189
|
+
* Field names whose values trigger re-fetching of async options.
|
|
190
|
+
* Only relevant when `options` is an async function.
|
|
191
|
+
*/
|
|
192
|
+
optionsDeps?: string[];
|
|
193
|
+
/** Internal: set by useForm when async options are loading. Read-only for consumers. */
|
|
194
|
+
optionsLoading?: boolean;
|
|
195
|
+
/** For group and array */
|
|
196
|
+
fields?: FieldDefinition[];
|
|
197
|
+
/**
|
|
198
|
+
* Applied on every setField call before the value is stored.
|
|
199
|
+
* Use for trimming, type coercion, formatting, etc.
|
|
200
|
+
*/
|
|
201
|
+
transform?: (value: unknown, values: Record<string, unknown>) => unknown;
|
|
202
|
+
/**
|
|
203
|
+
* Applied at submit time to produce the final payload value.
|
|
204
|
+
* Runs after all validation passes.
|
|
205
|
+
*/
|
|
206
|
+
parse?: (raw: unknown) => unknown;
|
|
207
|
+
/**
|
|
208
|
+
* Custom Vue component to render this field.
|
|
209
|
+
* Receives FormFieldProps and must emit 'update:modelValue' and 'blur'.
|
|
210
|
+
*/
|
|
211
|
+
component?: Component | string;
|
|
212
|
+
/** Accepted file types, e.g. "image/*,.pdf" — passed to <input accept> */
|
|
213
|
+
accept?: string;
|
|
214
|
+
/** Allow selecting multiple files */
|
|
215
|
+
multiple?: boolean;
|
|
216
|
+
/** Maximum file size in bytes */
|
|
217
|
+
maxSize?: number;
|
|
218
|
+
/** Maximum number of files (only relevant when multiple=true) */
|
|
219
|
+
maxFiles?: number;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
declare interface FieldOption {
|
|
223
|
+
label: string;
|
|
224
|
+
value: unknown;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group' | 'file';
|
|
228
|
+
|
|
229
|
+
declare interface MaskConfig {
|
|
230
|
+
preset?: MaskPreset;
|
|
231
|
+
/** Custom mask pattern: '#' = digit, 'A' = letter, other chars are literals */
|
|
232
|
+
pattern?: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare type MaskPreset = 'phone-ru' | 'phone-eu' | 'date' | 'inn' | 'iban';
|
|
236
|
+
|
|
237
|
+
export declare const PrimeVueFormRenderer: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
238
|
+
|
|
239
|
+
export declare const PvArrayField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_10<{
|
|
240
|
+
field: FieldDefinition;
|
|
241
|
+
form: UseFormReturn;
|
|
242
|
+
components?: Partial<Record<FieldDefinition["type"], Component | string>>;
|
|
243
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_10<{
|
|
244
|
+
field: FieldDefinition;
|
|
245
|
+
form: UseFormReturn;
|
|
246
|
+
components?: Partial<Record<FieldDefinition["type"], Component | string>>;
|
|
247
|
+
}>>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
248
|
+
|
|
249
|
+
export declare const PvCheckboxField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_6<{
|
|
250
|
+
field: FieldDefinition;
|
|
251
|
+
modelValue: boolean | null;
|
|
252
|
+
error?: string[];
|
|
253
|
+
touched?: boolean;
|
|
254
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
255
|
+
blur: () => void;
|
|
256
|
+
"update:modelValue": (value: boolean) => void;
|
|
257
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_6<{
|
|
258
|
+
field: FieldDefinition;
|
|
259
|
+
modelValue: boolean | null;
|
|
260
|
+
error?: string[];
|
|
261
|
+
touched?: boolean;
|
|
262
|
+
}>>> & Readonly<{
|
|
263
|
+
onBlur?: (() => any) | undefined;
|
|
264
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
265
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
266
|
+
|
|
267
|
+
export declare const PvDateField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_8<{
|
|
268
|
+
field: FieldDefinition;
|
|
269
|
+
modelValue: string | null;
|
|
270
|
+
error?: string[];
|
|
271
|
+
touched?: boolean;
|
|
272
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
273
|
+
blur: () => void;
|
|
274
|
+
"update:modelValue": (value: string) => void;
|
|
275
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_8<{
|
|
276
|
+
field: FieldDefinition;
|
|
277
|
+
modelValue: string | null;
|
|
278
|
+
error?: string[];
|
|
279
|
+
touched?: boolean;
|
|
280
|
+
}>>> & Readonly<{
|
|
281
|
+
onBlur?: (() => any) | undefined;
|
|
282
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
283
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
284
|
+
|
|
285
|
+
export declare const PvFileField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_9<{
|
|
286
|
+
field: FieldDefinition;
|
|
287
|
+
modelValue: File | File[] | null;
|
|
288
|
+
error?: string[];
|
|
289
|
+
touched?: boolean;
|
|
290
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
291
|
+
blur: () => void;
|
|
292
|
+
"update:modelValue": (value: File | File[] | null) => void;
|
|
293
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_9<{
|
|
294
|
+
field: FieldDefinition;
|
|
295
|
+
modelValue: File | File[] | null;
|
|
296
|
+
error?: string[];
|
|
297
|
+
touched?: boolean;
|
|
298
|
+
}>>> & Readonly<{
|
|
299
|
+
onBlur?: (() => any) | undefined;
|
|
300
|
+
"onUpdate:modelValue"?: ((value: File | File[] | null) => any) | undefined;
|
|
301
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
302
|
+
|
|
303
|
+
export declare const PvNumberField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_3<{
|
|
304
|
+
field: FieldDefinition;
|
|
305
|
+
modelValue: number | null;
|
|
306
|
+
error?: string[];
|
|
307
|
+
touched?: boolean;
|
|
308
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
309
|
+
blur: () => void;
|
|
310
|
+
"update:modelValue": (value: number | null) => void;
|
|
311
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_3<{
|
|
312
|
+
field: FieldDefinition;
|
|
313
|
+
modelValue: number | null;
|
|
314
|
+
error?: string[];
|
|
315
|
+
touched?: boolean;
|
|
316
|
+
}>>> & Readonly<{
|
|
317
|
+
onBlur?: (() => any) | undefined;
|
|
318
|
+
"onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
|
|
319
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
320
|
+
|
|
321
|
+
export declare const PvRadioField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_7<{
|
|
322
|
+
field: FieldDefinition;
|
|
323
|
+
modelValue: unknown;
|
|
324
|
+
error?: string[];
|
|
325
|
+
touched?: boolean;
|
|
326
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
327
|
+
blur: () => void;
|
|
328
|
+
"update:modelValue": (value: unknown) => void;
|
|
329
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_7<{
|
|
330
|
+
field: FieldDefinition;
|
|
331
|
+
modelValue: unknown;
|
|
332
|
+
error?: string[];
|
|
333
|
+
touched?: boolean;
|
|
334
|
+
}>>> & Readonly<{
|
|
335
|
+
onBlur?: (() => any) | undefined;
|
|
336
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
337
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
338
|
+
|
|
339
|
+
export declare const PvSelectField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_5<{
|
|
340
|
+
field: FieldDefinition;
|
|
341
|
+
modelValue: unknown;
|
|
342
|
+
error?: string[];
|
|
343
|
+
touched?: boolean;
|
|
344
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
345
|
+
blur: () => void;
|
|
346
|
+
"update:modelValue": (value: unknown) => void;
|
|
347
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_5<{
|
|
348
|
+
field: FieldDefinition;
|
|
349
|
+
modelValue: unknown;
|
|
350
|
+
error?: string[];
|
|
351
|
+
touched?: boolean;
|
|
352
|
+
}>>> & Readonly<{
|
|
353
|
+
onBlur?: (() => any) | undefined;
|
|
354
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
355
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
356
|
+
|
|
357
|
+
export declare const PvTextareaField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_4<{
|
|
358
|
+
field: FieldDefinition;
|
|
359
|
+
modelValue: string | null;
|
|
360
|
+
error?: string[];
|
|
361
|
+
touched?: boolean;
|
|
362
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
363
|
+
blur: () => void;
|
|
364
|
+
"update:modelValue": (value: string) => void;
|
|
365
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_4<{
|
|
366
|
+
field: FieldDefinition;
|
|
367
|
+
modelValue: string | null;
|
|
368
|
+
error?: string[];
|
|
369
|
+
touched?: boolean;
|
|
370
|
+
}>>> & Readonly<{
|
|
371
|
+
onBlur?: (() => any) | undefined;
|
|
372
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
373
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
374
|
+
|
|
375
|
+
export declare const PvTextField: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_2<{
|
|
376
|
+
field: FieldDefinition;
|
|
377
|
+
modelValue: string | null;
|
|
378
|
+
error?: string[];
|
|
379
|
+
touched?: boolean;
|
|
380
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
381
|
+
blur: () => void;
|
|
382
|
+
"update:modelValue": (value: string) => void;
|
|
383
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_2<{
|
|
384
|
+
field: FieldDefinition;
|
|
385
|
+
modelValue: string | null;
|
|
386
|
+
error?: string[];
|
|
387
|
+
touched?: boolean;
|
|
388
|
+
}>>> & Readonly<{
|
|
389
|
+
onBlur?: (() => any) | undefined;
|
|
390
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
391
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
392
|
+
|
|
393
|
+
declare interface UseFormReturn<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
394
|
+
fields: ComputedRef<FieldDefinition[]>;
|
|
395
|
+
values: Ref<T>;
|
|
396
|
+
errors: Ref<Record<string, string[]>>;
|
|
397
|
+
touched: Ref<Record<string, boolean>>;
|
|
398
|
+
/** Per-field async options loading state */
|
|
399
|
+
optionsLoading: Ref<Record<string, boolean>>;
|
|
400
|
+
isDirty: ComputedRef<boolean>;
|
|
401
|
+
isValid: ComputedRef<boolean>;
|
|
402
|
+
isSubmitting: Ref<boolean>;
|
|
403
|
+
submit(): Promise<void>;
|
|
404
|
+
reset(values?: Partial<T>): void;
|
|
405
|
+
setField(path: string, value: unknown): void;
|
|
406
|
+
getField(path: string): unknown;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
declare type ValidatorFn = (value: unknown, values: Record<string, unknown>) => string | null;
|
|
410
|
+
|
|
411
|
+
export { }
|