You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
949 B
2 lines
949 B
import{aX as m,ao as l,aj as p,u as s,ak as A,a_ as O,aY as u,a$ as Y}from"./index-f4658ae7.js";function _({defaultValueRef:d,getSchema:T,formModel:y,getProps:c}){function j(t){var i,o;if(!m(t))return{};const n={};for(const a of Object.entries(t)){let[,e]=a;const[f]=a;if(!f||l(e)&&e.length===0||p(e))continue;const r=s(c).transformDateFunc;m(e)&&(e=r==null?void 0:r(e)),l(e)&&((i=e[0])!=null&&i._isAMomentObject)&&((o=e[1])!=null&&o._isAMomentObject)&&(e=e.map(h=>r==null?void 0:r(h))),A(e)&&(e=e.trim()),O(n,f,e)}return M(n)}function M(t){const n=s(c).fieldMapToTime;if(!n||!Array.isArray(n))return t;for(const[i,[o,a],e="YYYY-MM-DD"]of n){if(!i||!o||!a||!t[i])continue;const[f,r]=t[i];t[o]=u(f).format(e),t[a]=u(r).format(e),Reflect.deleteProperty(t,i)}return t}function b(){const t=s(T),n={};t.forEach(i=>{const{defaultValue:o}=i;Y(o)||(n[i.field]=o,y[i.field]=o)}),d.value=n}return{handleFormValues:j,initDefault:b}}export{_ as useFormValues};
|