PageSourceSearch

https://ucon-i.jp/assets/BaseForm-DkSMNBcX.js

js ucon-i.jp collected 2026-10-02 18:59:52 UTC 14,329 bytes, 1 lines download raw bytes

1import{a7 as j,r as m,ef as $,j as w,dG as J,c as Ie,eg as G,dm as Oe}from"./index-B0uq8tPX.js";import{a as Ve,o as Te}from"./util-BqpKDu0j.js";import{d as ve,a as Le,p as Ne,u as Ue,P as Me}from"./index-B8sKERa_.js";import{c as L,u as C,r as Be,n as De,d as Ke,E as qe,F as ze,b as $e,a as Ge,i as _e,P as ke,G as He}from"./index-Du2T_ldr.js";import{c as We}from"./cloneDeep-DXsuNx8a.js";import{i as Xe,b as Ze,a as Y,S as ae,M as ge,c as ue,d as Je,e as Qe}from"./_initCloneObject-CK9H3rYZ.js";import{F as ee}from"./index-DrDmFeY2.js";import{B as Ye}from"./Button-78wM4zwe.js";import{S as et}from"./index-BkU1CgoC.js";function be(e,t){if(!t||!j.isValidElement(e))return e;if(e.type===j.Fragment){const s=j.Children.toArray(e.props.children).map((r,i)=>i===0?be(r,t):r);return j.cloneElement(e,{},...s)}return j.cloneElement(e,{...e.props,autoFocus:t})}let ce=0;function tt(e){const t=m.useRef(null),[n]=m.useState(()=>e.proFieldKey?e.proFieldKey.toString():(ce+=1,ce.toString())),s=async()=>{t.current?.abort();const o=new AbortController;t.current=o;try{return e.request?await e.request(e.params,o.signal):void 0}catch(u){if(u.name==="AbortError")return;throw u}},{data:r,isValidating:i}=ve(e.request?[n,e.params]:null,s,{revalidateOnFocus:!1,shouldRetryOnError:!1,onError:()=>{}});return e.request?[r,i]:[void 0,!1]}const nt=e=>{const t=m.useRef();return m.useEffect(()=>{t.current=e}),t.current};function rt(e){const t=typeof window<"u"&&window.location?window.location.href:"http://localhost/",n=new URL(t);return Object.keys(e).forEach(s=>{const r=e[s];r!=null?Array.isArray(r)?(n.searchParams.delete(s),r.forEach(i=>{n.searchParams.append(s,String(i))})):r instanceof Date?Number.isNaN(r.getTime())||n.searchParams.set(s,r.toISOString()):typeof r=="object"?n.searchParams.set(s,JSON.stringify(r)):n.searchParams.set(s,String(r)):n.searchParams.delete(s)}),n}const st={true:!0,false:!1};function ot(e,t,n,s){if(!n)return t;const r=n[e],i=t===void 0?s[e]:t;return r===Number?Number(i):r===Boolean||t==="true"||t==="false"?st[String(i)]:Array.isArray(r)?r.find(o=>o==i)??s[e]:i}function it(e={},t={disabled:!1}){const[,n]=m.useState(),s=typeof window<"u"&&window.location?window.location.search:void 0,r=m.useMemo(()=>t.disabled?{}:new URLSearchParams(s??""),[t.disabled,s]),i=m.useMemo(()=>{if(t.disabled)return{};if(typeof window>"u"||!window.URL)return{};const a=[];r.forEach((d,f)=>{a.push({key:f,value:d})});const c=a.reduce((d,f)=>((d[f.key]=d[f.key]||[]).push(f),d),{}),h=Object.keys(c).map(d=>{const f=c[d];return f.length===1?[d,f[0].value]:[d,f.map(y=>y.value)]}),p={...e};return h.forEach(([d,f])=>{p[d]=ot(d,f,{},e)}),p},[t.disabled,e,r]);function o(a){if(typeof window>"u"||!window.URL)return;const c=rt(a);window.location.search!==c.search&&window.history.replaceState({},"",c.toString()),(r instanceof URLSearchParams?r.toString():Object.prototype.toString.call(r))!==c.searchParams.toString()&&n({})}m.useEffect(()=>{t.disabled||typeof window>"u"||!window.URL||o({...e,...i})},[t.disabled,i]);const u=a=>{o(a)};return m.useEffect(()=>{if(t.disabled)return()=>{};if(typeof window>"u"||!window.URL)return()=>{};const a=()=>{n({})};return window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}},[t.disabled]),[i,u]}var at="[object Symbol]";function te(e){return typeof e=="symbol"||Xe(e)&&Ze(e)==at}function ut(e,t){for(var n=-1,s=e==null?0:e.length,r=Array(s);++n<s;)r[n]=t(e[n],n,e);return r}var fe=ae?ae.prototype:void 0,le=fe?fe.toString:void 0;function we(e){if(typeof e=="string")return e;if(Y(e))return ut(e,we)+"";if(te(e))return le?le.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var ct=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ft=/^\w*$/;function lt(e,t){if(Y(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||te(e)?!0:ft.test(e)||!ct.test(e)||t!=null&&e in Object(t)}var dt="Expected a function";function ne(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(dt);var n=function(){var s=arguments,r=t?t.apply(this,s):s[0],i=n.cache;if(i.has(r))return i.get(r);var o=e.apply(this,s);return n.cache=i.set(r,o)||i,o};return n.cache=new(ne.Cache||ge),n}ne.Cache=ge;var mt=500;function pt(e){var t=ne(e,function(s){return n.size===mt&&n.clear(),s}),n=t.cache;return t}var ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yt=/\\(\\)?/g,gt=pt(function(e){var t=[];
1return e.charCodeAt(0)===46&&t.push(""),e.replace(ht,function(n,s,r,i){t.push(r?i.replace(yt,"$1"):s||n)}),t});function bt(e){return e==null?"":we(e)}function wt(e,t){return Y(e)?e:lt(e,t)?[e]:gt(bt(e))}function Pt(e){if(typeof e=="string"||te(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function St(e,t,n,s){if(!ue(e))return e;t=wt(t,e);for(var r=-1,i=t.length,o=i-1,u=e;u!=null&&++r<i;){var a=Pt(t[r]),c=n;if(a==="__proto__"||a==="constructor"||a==="prototype")return e;if(r!=o){var h=u[a];c=void 0,c===void 0&&(c=ue(h)?h:Je(t[r+1])?[]:{})}Qe(u,a,c),u=u[a]}return e}function Ft(e,t,n){return e==null?e:St(e,t,n)}function xt(e){return typeof e!="object"?!1:e===null?!0:!(j.isValidElement(e)||e.constructor===RegExp||e instanceof Map||e instanceof Set||typeof HTMLElement<"u"&&e instanceof HTMLElement||typeof Blob<"u"&&e instanceof Blob||typeof File<"u"&&e instanceof File||Array.isArray(e))}function Rt(e){return e.split(".").map(t=>/^\d+$/.test(t)?parseInt(t,10):t)}function Et(e){const t={};for(const n in e){const s=e[n];L(s)||(t[n]=s)}return t}function jt(e){const t={},n={};for(const s in e){const r=e[s];L(r)||(s.includes(".")?t[s]=r:n[s]=r)}return{dotPathTransforms:t,objectTransforms:n}}function Ct(e,t){for(const n of Object.keys(t)){const s=t[n];if(typeof s!="function")continue;const r=Rt(n),i=$(e,r);if(i===void 0)continue;const o=s(i,r.map(String),e);if(typeof o=="object"&&o!==null&&!Array.isArray(o)){const u=r.slice(0,-1),a=u.length>0?$(e,u):e,c=r[r.length-1];Array.isArray(a)?a[c]=o:a&&typeof a=="object"&&(delete a[c],Object.assign(a,o))}else Ft(e,r,o)}}function At(e,t,n){const s=[...t.map(String),n],r=$(e,s);return typeof r=="function"?r:void 0}function It(e,t){let n=e;for(const s of t){if(Array.isArray(n))return!0;if(n==null||typeof n!="object")return!1;n=n[s]}return Array.isArray(n)}function Q(e,t,n,s,r){const i=Array.isArray(e),o=i?[]:{};if(e==null||e===void 0)return o;const u=i?e.map((a,c)=>c.toString()):Object.keys(e);for(const a of u){const c=t?[...t,a]:[a],h=e[a];let p=n[a];if(!p&&t&&(p=At(n,t,a)),p&&typeof p=="function"){const d=c.map(y=>String(y)),f=p(h,d,r);typeof f=="object"&&f!==null&&!Array.isArray(f)?(t?It(r,t):!1)?Object.assign(o,f):s.push(f):o[a]=f}else if(xt(h)&&!L(h)){const d=n[a];if(d&&typeof d=="object"){const f=Q(h,c,d,s,r);Object.keys(f).length>0&&(o[a]=f)}else{const f=Q(h,c,n,s,r);o[a]=f}}else L(h)||(o[a]=h)}return o}const Ot=(e,t)=>{const n=Et(t);if(Object.keys(n).length<1||typeof window>"u"||typeof e!="object"||L(e)||e instanceof Blob)return e;let s=We(e);const{dotPathTransforms:r,objectTransforms:i}=jt(t);Ct(s,r);const o=[];Object.keys(i).length>0&&(s=Q(s,void 0,i,o,s));for(const u of o)Object.assign(s,u);return s},z=(e,t,n)=>e===!0?t:Be(e,t,n);function Vt({syncToUrl:e,syncToInitialValues:t,extraUrlParams:n}){const[s,r]=it({},{disabled:!e}),[i,o]=m.useState(()=>e?z(e,s,"get"):{});m.useEffect(()=>{t||o({})},[t]);const u=m.useRef(s);m.useEffect(()=>{u.current=s},[s]);const a=C(()=>({...u.current,...n}));m.useEffect(()=>{e&&r(z(e,a(),"set"))},[n,a,e]);const c=C((p,d)=>{if(!e)return;const f=Object.keys(p).reduce((y,g)=>({...y,[g]:p[g]||void 0}),d??{});r(z(e,f,"set"))}),h=C((p,d,f)=>{if(!e)return;const y=d.reduce((g,O)=>({...g,[O]:p[O]??void 0}),f??{});Object.keys(u.current).forEach(g=>{y[g]!==!1&&y[g]!==0&&!y[g]&&(y[g]=void 0)}),r(z(e,y,"set"))});return{urlParamsMergeInitialValues:i,onUrlSyncReset:c,onUrlSyncFinish:h}}function de(e,t,n,s,r){const{preventDefault:i,onClick:o,fieldProps:u,...a}=e;return m.createElement(Ye,{...r,...a,key:t,onClick:c=>{i||s(),o?.(c)}},n)}const Tt=e=>{const t=Le(),n=ee.useFormInstance();if(e.render===!1)return null;const{onSubmit:s,render:r,onReset:i,searchConfig:o={},submitButtonProps:u,resetButtonProps:a}=e,{token:c}=Ne.useToken(),h=()=>{n.submit(),s?.()},p=()=>{n.resetFields(),i?.()},{submitText:d=t.getMessage("tableForm.submit","提交"),resetText:f=t.getMessage("tableForm.reset","重置")}=o,y=[];a!==!1&&y.push(de(a??{},"rest",f,p)),u!==!1&&y.push(de(u??{},"submit",d,h,{type:"primary"}));const g=r?r({...e,form:n,submit:h,reset:p},y):y;return g?Array.isArray(g)?g.length<1?null:g.length===1?g[0]:w.jsx("div",{style:{display:"flex",gap:c.marginXS,alignItems:"center"},children:g}):g:null},{noteOnce:me}=Oe,pe=e=>!e||Array.isArray(e)?e:[e],Pe={};function he(e,t,n){return{getFieldsFormatValue:(s,r)=>{const i=e();if(!i)return{};const o=i.getFieldsValue(s);return t(o,r!==void 0?r:n)},getFieldFormatValue:(s=[],r)=>{const i=e();if(!i)return;const o=pe(s);if(!o)throw new Error("nameList is require");const u=i.getFieldValue(o),a=o?G({},o,u):u,c=[...o];c.shift();const h=t(a,r!==void 0?r:n,c),p=$(h,o);return p&&typeof p=="object"&&!Array.isArray(p)?Object.values(p)[
10]:p},getFieldFormatValueObject:(s,r)=>{const i=e();if(!i)return{};const o=pe(s),u=i.getFieldValue(o),a=o?G({},o,u):u,c=o?[...o]:[];return c.shift(),t(a,r!==void 0?r:n,c)},validateFieldsReturnFormatValue:async(s,r)=>{const i=e();if(!i)return{};if(!Array.isArray(s)&&s)throw new Error("nameList must be array");const o=await i.validateFields(s);return t(o,r!==void 0?r:n)??{}}}}function vt(e){const{children:t,contentRender:n,submitter:s,fieldProps:r,formItemProps:i,groupProps:o,transformKey:u,formRef:a,onInit:c,form:h,loading:p,formComponentType:d,extraUrlParams:f=Pe,syncToUrl:y,onUrlSyncReset:g,onReset:O,omitNil:F=!0,isKeyPressSubmit:Se,autoFocusFirstInput:_=!0,grid:N,rowProps:re,colProps:U,...A}=e,M=ee.useFormInstance(),{componentSize:T}=J?.useConfig?.()||{componentSize:"middle"},R=m.useRef(h||M),{RowWrapper:se}=Ge({grid:N,rowProps:re}),B=C(()=>M),D=m.useMemo(()=>he(B,u,F),[F,u,B]),I=j.Children.toArray(t).map((b,H)=>H===0&&j.isValidElement(b)&&_?be(b,_):b),S=typeof s=="boolean"||!s?{}:s,K=s===!1?void 0:w.jsx(Tt,{...S,onReset:()=>{const b=u(R.current?.getFieldsValue(),F);S?.onReset?.(b),O?.(b),g(b,f)},submitButtonProps:{loading:p,...S.submitButtonProps}},"submitter"),q=N?w.jsx(se,{children:I}):I,k=n?n(q,K,R.current):q,E=nt(e.initialValues);return m.useEffect(()=>{if(y||!e.initialValues||!E||A.request)return;const b=_e(e.initialValues,E);me(b,"initialValues 只在 form 初始化时生效,如果你需要异步加载推荐使用 request,或者 initialValues ? <Form/> : null "),me(b,"The initialValues only take effect when the form is initialized, if you need to load asynchronously recommended request, or the initialValues ? <Form/> : null ")},[e.initialValues]),m.useImperativeHandle(a,()=>({...R.current,...he(()=>R.current,u,F)}),[F,u,a]),m.useEffect(()=>{const b=u(R.current?.getFieldsValue?.(!0),F);c?.(b,{...R.current,...D})},[]),w.jsx(ke.Provider,{value:{...D,formRef:R},children:w.jsx(J,{componentSize:A.size||T,children:w.jsxs(He.Provider,{value:{grid:N,colProps:U},children:[A.component!==!1&&w.jsx("input",{type:"text",style:{display:"none"}}),k]})})})}let ye=0;function $t(e){const{extraUrlParams:t=Pe,syncToUrl:n,isKeyPressSubmit:s,syncToUrlAsImportant:r=!1,syncToInitialValues:i=!0,children:o,contentRender:u,submitter:a,fieldProps:c,proFieldProps:h,formItemProps:p,groupProps:d,dateFormatter:f="string",formRef:y,onInit:g,form:O,formComponentType:F,onReset:Se,grid:_,rowProps:N,colProps:re,omitNil:U=!0,request:A,params:M,initialValues:T,formKey:R=ye,readonly:se,onLoadingChange:B,loading:D,...I}=e,S=m.useRef({}),[K,q]=Ve(!1,D),k=C(l=>{B?.(l)}),E=C(l=>{q(P=>{const x=typeof l=="function"?l(P):l;return queueMicrotask(()=>{k(x)}),x})}),{urlParamsMergeInitialValues:b,onUrlSyncReset:H,onUrlSyncFinish:Fe}=Vt({syncToUrl:n,syncToInitialValues:i,extraUrlParams:t}),xe=m.useRef(De());m.useEffect(()=>{ye+=1},[]);const[v,oe]=tt({request:A,params:M,proFieldKey:R}),{getPrefixCls:Re}=m.useContext(J.ConfigContext),ie=Re("pro-form"),{wrapSSR:Ee,hashId:je}=Ue("ProForm",l=>({[`.${ie}`]:{[`> div:not(${l.proComponentsCls}-form-light-filter)`]:{".pro-field":{maxWidth:"100%","@media screen and (max-width: 575px)":{maxWidth:"calc(93vw - 48px)"},"&-xs":{width:104},"&-s":{width:216},"&-sm":{width:216},"&-m":{width:328},"&-md":{width:328},"&-l":{width:440},"&-lg":{width:440},"&-xl":{width:552}}}}})),W=m.useRef({}),X=m.useRef({}),Z=C((l,P,x)=>!l||typeof l!="object"?l:Ot(Ke(l,f,X.current,P,x),W.current)),Ce=m.useMemo(()=>{if(!(typeof window>"u")&&F&&["DrawerForm"].includes(F))return l=>l.parentNode||document.body},[F]),Ae=C(async()=>{if(I.onFinish&&!K)try{E(!0);const l=S?.current?.getFieldsFormatValue?.()||{},P=I.onFinish(l);let x;if(P&&typeof P=="object"&&typeof P.then=="function"){try{x=await P}catch(V){throw E(!1),V}E(!1)}else x=P,E(!1);if(x){const V=Object.keys(S?.current?.getFieldsFormatValue?.(!0,!1)||{});Fe(l,V,t)}}catch{E(!1)}});return m.useImperativeHandle(y,()=>S.current,[!v]),A&&oe?w.jsx("div",{style:{paddingTop:50,paddingBottom:50,textAlign:"center"},children:w.jsx(et,{})}):Ee(w.jsx(qe.Provider,{value:{mode:e.readonly?"read":"edit"},children:w.jsx(Me,{needDeps:!0,children:w.jsx(ze.Provider,{value:{formRef:S,fieldProps:c,proFieldProps:h,formItemProps:p,groupProps:d,formComponentType:F,getPopupContainer:Ce,formKey:xe.current,setFieldValueType:(l,{valueType:P="text",dateFormat:x,transform:V})=>{Array.isArray(l)&&(V&&(W.current=G(W.current,l,V)),X.current=G(X.current,l,{valueType:P,dateFormat:x}))}},children:w.jsx($e.Provider,{value:{},children:w.jsx(ee,{onKeyDown:l=>{s&&l.key==="Enter"&&S.current?.submit()},autoComplete:"off",form:O,...Te(I,["ref","labelWidth","autoFocusFirstInput","rootClassName"]),ref:l=>{S.current&&(S.current.nativeElement=l?.nativeElement,S.current.focus=()=>{l?.nativeElement?.querySelector("input, textarea, select")?.focus()})},initialValues:r?{...T,...v,...b}:{...b,...T,...v},onValuesChange:(l,P)=>{I?.onValuesChange?.(Z(l,!!U),Z(P,!!U))},className:e.className,rootClassName:Ie(ie,je,e.rootClassName),onFinish:Ae,children:w.jsx(vt,{transformKey:Z,autoComplete:"off",loading:K||!!(A&&!v&&oe),onUrlSyncReset:H,...e,formRef:S,initialValues:{...T,...v}})})})})})}))}export{$t as B,be as a,nt as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.