@qfei-design/make-app-approval 0.2.13 → 0.2.15

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/dist/list.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var ge=Object.create;var ne=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var ye=(e,t,i,R)=>{if(t&&typeof t=="object"||typeof t=="function")for(let z of be(t))!ke.call(e,z)&&z!==i&&ne(e,z,{get:()=>t[z],enumerable:!(R=ve(t,z))||R.enumerable});return e};var xe=(e,t,i)=>(i=e!=null?ge(we(e)):{},ye(t||!e||!e.__esModule?ne(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),c=require("react"),Se=require("./index.cjs"),de=e=>typeof e=="object"&&e!==null,je=e=>de(e)?["id","entityKey","recordId"].every(t=>typeof e[t]=="string"&&e[t].trim().length>0)&&["applicationNo","applicationType","applicantName","applicationTime"].every(t=>typeof e[t]=="string")&&["taskId","processInstanceId"].every(t=>e[t]===void 0||typeof e[t]=="string"&&e[t].trim().length>0)&&["completionTime","completionResult"].every(t=>e[t]===void 0||typeof e[t]=="string")&&(e.referenceType===void 0||e.referenceType==="task"||e.referenceType==="instance")&&(e.referenceType!=="instance"||typeof e.processInstanceId=="string"&&e.processInstanceId.trim().length>0)&&(typeof e.processStatus=="string"||e.processStatus===null):!1,Q=(e,t)=>{if(!de(e)||!Array.isArray(e.rows)||!e.rows.every(je)||typeof e.total!="number"||!Number.isSafeInteger(e.total)||e.total<0||e.rows.length>t||e.rows.length>e.total||new Set(e.rows.map(i=>i.id)).size!==e.rows.length)throw new Error("Invalid approval page contract");return{rows:e.rows,total:e.total}},A=(e,t)=>{try{e?e(t):t.phase==="error"?console.warn("[make-app-approval]",t):console.info("[make-app-approval]",t)}catch{console.warn("[make-app-approval] diagnostic sink failed")}},ae=e=>e==null||e==="UNSUBMITTED"?"状态未知":Se.getApprovalStatusDisplay(e).label,Ne=({initialPage:e,query:t,provider:i,components:R,onOpen:z,onReload:M,logger:E})=>{const[v,x]=c.useState(e),[w,P]=c.useState(2),[d,j]=c.useState("idle"),h=c.useRef(void 0),[S,L]=c.useState(!1),N=c.useRef(void 0);c.useEffect(()=>()=>{N.current?.abort()},[]);const p=async()=>{if(N.current||v.rows.length>=v.total)return;const s=new AbortController;N.current=s,j("loading");const f={operation:"list",tab:t.tab,page:w,pageSize:t.pageSize};A(E,{...f,phase:"start"});try{const u=Q(await i.loadPage({...t,page:w},{signal:s.signal}),t.pageSize);if(s.signal.aborted)return;if(u.total<v.total){A(E,{...f,phase:"skip",rowCount:u.rows.length}),M();return}const m=new Set(v.rows.map(T=>T.id));if(!u.rows.length||u.rows.some(T=>m.has(T.id)))throw new Error("Invalid append page");x({rows:[...v.rows,...u.rows],total:u.total}),P(T=>T+1),j("idle"),A(E,{...f,phase:"success",rowCount:u.rows.length})}catch{s.signal.aborted||(j("error"),A(E,{...f,phase:"error"}))}finally{N.current===s&&(N.current=void 0)}},C=s=>{const{scrollHeight:f,scrollTop:u,clientHeight:m}=s.currentTarget;d==="idle"&&f-u-m<120&&p()},{Button:D}=R;return a.jsxs("div",{className:"make-app-approval-mobile-list",onScroll:C,onTouchStart:s=>{h.current=s.currentTarget.scrollTop<=0&&s.touches.length===1&&d!=="loading"?{start:s.touches[0].clientY,distance:0}:void 0},onTouchMove:s=>{!h.current||s.touches.length!==1||(h.current.distance=s.touches[0].clientY-h.current.start,L(h.current.distance>=60))},onTouchEnd:()=>{const s=(h.current?.distance??0)>=60;h.current=void 0,L(!1),s&&M()},onTouchCancel:()=>{h.current=void 0,L(!1)},"aria-label":"审批卡片列表","aria-busy":d==="loading",children:[S&&a.jsx("p",{role:"status",className:"make-app-approval-mobile-feedback",children:"松开刷新"}),v.rows.map(s=>a.jsxs("button",{type:"button",className:"make-app-approval-mobile-card",onClick:()=>z(s),"aria-label":`打开 ${s.applicationNo} 的审批详情`,children:[a.jsx("strong",{children:s.applicationType||"审批申请"}),a.jsxs("span",{className:"make-app-approval-mobile-card-line",children:[a.jsx("span",{children:"申请单ID:"}),a.jsx("span",{children:s.applicationNo})]}),t.tab==="approved"&&a.jsxs("span",{className:"make-app-approval-mobile-card-line",children:[a.jsx("span",{children:"审批结果:"}),a.jsx("span",{children:s.completionResult||"—"})]}),t.tab==="initiated"&&a.jsxs("span",{className:"make-app-approval-mobile-card-line",children:[a.jsx("span",{children:"流程状态:"}),a.jsx("span",{children:ae(s.processStatus)})]}),a.jsxs("span",{className:"make-app-approval-mobile-card-footer",children:[a.jsxs("span",{className:"make-app-approval-mobile-person",children:[a.jsx("span",{className:"make-app-approval-mobile-avatar","aria-hidden":"true",children:s.applicantName.slice(-2)}),a.jsx("span",{children:s.applicantName||"—"})]}),a.jsx("span",{children:t.tab==="approved"?`完成于 ${s.completionTime||"—"}`:`申请于 ${s.applicationTime||"—"}`})]})]},s.id)),!v.rows.length&&a.jsx("p",{className:"make-app-approval-mobile-feedback",children:"暂无审批记录"}),d==="error"?a.jsxs("div",{role:"alert",className:"make-app-approval-mobile-feedback",children:["部分审批记录加载失败",a.jsx(D,{htmlType:"button",variant:"text",onClick:()=>{p()},children:"重试加载"})]}):d==="loading"?a.jsx("p",{role:"status",className:"make-app-approval-mobile-feedback",children:"加载中"}):v.rows.length<v.total?a.jsx(D,{htmlType:"button",variant:"text",onClick:()=>{p()},children:"加载更多"}):v.rows.length>0&&a.jsx("p",{className:"make-app-approval-mobile-feedback",children:"没有更多了"})]})},Te={applicationNo:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-fingerprint-pattern" aria-hidden="true"><path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"></path><path d="M14 13.12c0 2.38 0 6.38-1 8.88"></path><path d="M17.29 21.02c.12-.6.43-2.3.5-3.02"></path><path d="M2 12a10 10 0 0 1 18-6"></path><path d="M2 16h.01"></path><path d="M21.8 16c.2-2 .131-5.354 0-6"></path><path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"></path><path d="M8.65 22c.21-.66.45-1.32.57-2"></path><path d="M9 6.8a6 6 0 0 1 9 5.2v2"></path></svg>',applicationType:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-type" aria-hidden="true"><path d="M12 4v16"></path><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"></path><path d="M9 20h6"></path></svg>',applicantName:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-round" aria-hidden="true"><circle cx="12" cy="8" r="5"></circle><path d="M20 21a8 8 0 0 0-16 0"></path></svg>',applicationTime:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-calendar-clock" aria-hidden="true"><path d="M16 14v2.2l1.6 1"></path><path d="M16 2v3"></path><path d="M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338"></path><path d="M3 9h5.859"></path><path d="M8 2v3"></path><circle cx="16" cy="16" r="6"></circle></svg>'},ie=Object.fromEntries(Object.entries(Te).map(([e,t])=>[e,`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`])),te=64,le=[{key:"applicationNo",title:"申请单ID",width:260},{key:"applicationType",title:"业务表单",width:180},{key:"applicantName",title:"申请人",width:170},{key:"applicationTime",title:"申请时间",width:220}],ce=(e,t)=>{const i=t==="initiated"?[...le,{key:"statusLabel",title:"流程状态",width:140}]:le,R=i.reduce((M,E)=>M+E.width,te),z=Math.max(0,e-R)/i.length;return i.map(M=>({...M,width:M.width+z,showEllipsis:!0,sortable:!1,prefixRender:()=>({icon:ie[M.key]??ie.applicationType})}))},Re=({table:e,query:t,initialPage:i,loadPage:R,onChange:z,retryViewport:M,onReload:E,logger:v})=>{const x=new Map,w=new Set;let P=[];const d=new WeakMap,j=new Set;let h=i,S=i.total,L=0,N=!1,p=!1,C;const D=o=>Number.isSafeInteger(o)&&o>=0&&o*t.pageSize<S,s=(o,r,g)=>A(v,{operation:"list",phase:r,tab:t.tab,page:o+1,pageSize:t.pageSize,rowCount:g}),f=()=>{N||z({total:S,rows:P,failed:p||j.size>0,loading:x.size>0})},u=o=>{o.finished||(o.finished=!0,o.removeAbort(),x.get(o.page)===o&&x.delete(o.page),e.markPageLoadFailed(o.page,o.request),o.controller.abort(),s(o.page,"cancel"))},m=o=>{L=o;const r=e.getPagesInView()??[],g=new Set([L,...r].flatMap(k=>[k-1,k,k+1]).filter(D));for(const k of x.values())g.has(k.page)||u(k);for(const k of j)g.has(k)||j.delete(k)},T=(o,r,g)=>{const k=r.rows.map(b=>{const $={...b,statusLabel:ae(b.processStatus)};return d.set($,b),$});if(!e.setVirtualPageData(k,o,r.total,g)){s(o,"skip");return}S=r.total;try{P=Q({rows:e.getTableData()??[],total:S},Number.MAX_SAFE_INTEGER).rows.map(b=>d.get(b)??b)}catch(b){p=!0,P=[],h=void 0,C&&clearTimeout(C),C=void 0;for(const $ of x.values())u($);throw b}h&&h.total!==S&&(h=void 0),j.delete(o);for(const b of x.values())D(b.page)||u(b);!D(o)&&o>0&&e.scrollToRow(Math.max(0,S-1)),s(o,"success",r.rows.length)},B=()=>{if(N||C)return;const o=[...x.values()].filter(r=>!r.running&&!r.finished).sort((r,g)=>Math.abs(r.page-L)-Math.abs(g.page-L)||r.page-g.page);for(const r of o){if(w.size>=2)break;r.running=!0,w.add(r),s(r.page,"start"),(async()=>{try{const g=await R({...t,page:r.page+1},{signal:r.controller.signal});if(N||r.finished||r.controller.signal.aborted)return;const k=Q(g,t.pageSize);r.finished=!0,r.removeAbort(),x.delete(r.page),T(r.page,k,r.request)}catch{!N&&!r.controller.signal.aborted&&(j.add(r.page),s(r.page,"error"),e.markPageLoadFailed(r.page,r.request))}finally{r.finished||(r.finished=!0,r.removeAbort(),x.get(r.page)===r&&x.delete(r.page)),w.delete(r),f(),B()}})()}f()},O=()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=void 0,B()},120)};return{load(o,r){if(r.useRequestIdentity(),N||p||r.signal.aborted||!D(o)){e.markPageLoadFailed(o,r),s(o,"skip");return}const g=x.get(o);if(g?.request===r&&!g.finished)return;if(g&&u(g),m(o),o===0&&h){const b=h;h=void 0;try{T(0,b,r)}catch{j.add(o),e.markPageLoadFailed(o,r),s(o,"error")}f();return}const k={page:o,request:r,controller:new AbortController,running:!1,finished:!1,removeAbort:()=>{}},V=()=>{u(k),f()};r.signal.addEventListener("abort",V,{once:!0}),k.removeAbort=()=>r.signal.removeEventListener("abort",V),x.set(o,k),O(),f()},viewportChanged(){if(N)return;const o=e.getPagesInView();o?.length&&(m(o[0]),x.size&&O(),f())},retry(){if(!N){if(p){E();return}j.size!==0&&(j.clear(),M(),f())}},dispose(){N=!0,C&&clearTimeout(C),C=void 0;for(const o of x.values())u(o);P=[],j.clear(),h=void 0}}},pe=40,Ce=e=>{const t=c.useRef(void 0);return e.initialPage?a.jsx(Me,{...e,initialPage:e.initialPage,restoreScroll:t.current?.query===e.query?t.current.position:void 0,rememberScroll:i=>{t.current={query:e.query,position:i}}}):a.jsx("div",{className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"})},Me=({components:{Button:e},initialPage:t,query:i,provider:R,themeKey:z,onOpen:M,onReload:E,logger:v,restoreScroll:x,rememberScroll:w})=>{const P=c.useRef(null),d=c.useRef(null),j=c.useRef(null),[h,S]=c.useState(!1),[L,N]=c.useState(0),[p,C]=c.useState({...t,failed:!1,loading:!1}),D=c.useRef(t.rows),s=c.useRef(x),f=c.useRef({provider:R,onOpen:M,onReload:E,logger:v,rememberScroll:w});f.current={provider:R,onOpen:M,onReload:E,logger:v,rememberScroll:w};const u=c.useRef(()=>{});return c.useEffect(()=>{const m=P.current;if(!m)return;let T=!1,B,O,o,r,g,k=t.total;A(f.current.logger,{operation:"table",phase:"start"});const V=()=>{T||(S(!0),A(f.current.logger,{operation:"table",phase:"error"}))};return import("@qfei-design/canvas-table").then(b=>{if(T)return;const $=()=>{const n=d.current,l=n?.getScrollState();n&&l&&b.globalEventBus.emitWithNamespace("scroll:change",n.tableId,l)},Y=(n=!1)=>{if(!T)try{const{width:l,height:F}=m.getBoundingClientRect();if(l<=0||F<=0||!n&&g?.width===l&&g.height===F)return;const H=getComputedStyle(m),re={rowHeight:pe,headerHeight:40,fontSize:14,fontFamily:H.fontFamily||"Arial, sans-serif",...H.color?{textColor:H.color}:{},...H.getPropertyValue("--make-approval-bg").trim()?{rowBgColor:H.getPropertyValue("--make-approval-bg").trim()}:{},...H.getPropertyValue("--make-approval-header").trim()?{headerBgColor:H.getPropertyValue("--make-approval-header").trim()}:{},...H.getPropertyValue("--make-approval-border").trim()?{borderColor:H.getPropertyValue("--make-approval-border").trim()}:{}},fe=Math.max(Math.ceil(300/i.pageSize),Math.ceil(F*3/pe/i.pageSize)+2)*i.pageSize,oe={enabled:!0,totalRowCount:k,pageSize:i.pageSize,maxCachedRows:fe};if(d.current){const y=g?.width!==l?ce(l,i.tab):void 0;if(d.current.updateProps({canvasWidth:l,canvasHeight:F,style:re,virtualOptions:oe,...y?{columns:y}:{}}),y){const I=d.current.getScrollState(),K=Math.max(0,y.reduce((U,q)=>U+q.width,te)-l);I&&I.scrollX>K&&d.current.scrollTo(K,I.scrollY,!1)}g={width:l,height:F},$();return}d.current=new b.CanvasTableComponent(m,{columns:ce(l,i.tab),canvasWidth:l,canvasHeight:F,style:re,rowKey:"id",showSN:{enabled:!0,width:te,formatter:(y,I)=>I+1},virtualOptions:oe,selectable:{enabled:!1},rowSortable:{enabled:!1},editApplyMode:"controlled",customEdit:y=>{y.cancel()},emptyStateOptions:{text:"暂无审批记录"},bodyRowHeadSuffixOptions:{enabled:!0,width:20,render:({group:y,x:I,height:K,rowData:U})=>{const q=U?.id,_=new b.RectShape({name:"approval-open",x:I,y:K/2-10,cursor:"pointer",tooltip:"查看审批详情",attrs:{width:20,height:20,fill:"transparent",stroke:"transparent"}});_.addChild(new b.ImgShape({name:"approval-open-icon",x:3,y:3,attrs:{width:14,height:14,img:"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${H.color||"#64748b"}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)}})),_.on("mousedown",ee=>ee.stopPropagation?.()),_.on("click",ee=>{ee.stopPropagation?.();const se=D.current.find(me=>me.id===q);se&&f.current.onOpen(se)}),y.addChild(_)}}});const X=d.current;g={width:l,height:F};const Z=Re({table:X,query:i,initialPage:t,retryViewport:$,onReload:()=>f.current.onReload(),loadPage:(y,I)=>f.current.provider.loadPage(y,I),logger:y=>A(f.current.logger,y),onChange:y=>{T||(k=y.total,D.current=y.rows,C(I=>I.total===y.total&&I.failed===y.failed&&I.loading===y.loading&&I.rows.length===y.rows.length&&I.rows.every((K,U)=>K===y.rows[U])?I:y))}});j.current=Z,O=b.globalEventBus.onWithNamespace("data:load",X.tableId,(y,I)=>Z.load(y,I)),o=b.globalEventBus.onWithNamespace("scroll:change",X.tableId,()=>Z.viewportChanged()),s.current&&X.scrollTo(s.current.scrollX,s.current.scrollY),S(!1),A(f.current.logger,{operation:"table",phase:"success"})}catch{V()}};u.current=()=>Y(!0);const W=()=>Y();B=new ResizeObserver(W),B.observe(m),window.addEventListener("resize",W),r=()=>window.removeEventListener("resize",W),Y()}).catch(V),()=>{T=!0,B?.disconnect(),r?.(),u.current=()=>{},d.current&&(s.current=d.current.getScrollState(),s.current&&f.current.rememberScroll(s.current)),O?.(),o?.(),j.current?.dispose(),j.current=null,d.current?.destroy(),d.current=null,A(f.current.logger,{operation:"table",phase:"destroy"})}},[t,i,L]),c.useEffect(()=>{u.current()},[z]),a.jsxs("div",{className:"make-app-approval-table-frame","aria-busy":p.loading,children:[a.jsx("div",{ref:P,className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"}),h&&a.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:["表格加载失败 ",a.jsx(e,{htmlType:"button",variant:"default",onClick:()=>{S(!1),N(m=>m+1)},children:"重新加载表格"})]}),!h&&p.failed&&a.jsxs("div",{className:"make-app-approval-table-feedback",role:"alert",children:["部分审批记录加载失败 ",a.jsx(e,{htmlType:"button",variant:"default",onClick:()=>j.current?.retry(),children:"重试加载"})]}),!h&&!p.failed&&p.loading&&a.jsxs("div",{className:"make-app-approval-table-loading",role:"status","aria-label":"正在加载审批记录","aria-live":"polite",children:[a.jsx("span",{className:"make-app-approval-loading-spinner","aria-hidden":"true"}),a.jsx("span",{children:"加载中"})]}),a.jsxs("ul",{className:"make-app-approval-accessible-rows","aria-label":"审批记录文字视图",children:[p.total===0&&a.jsx("li",{children:"暂无审批记录"}),p.rows.map(m=>a.jsxs("li",{children:[a.jsxs("span",{children:[m.applicationNo,",",m.applicationType,",",m.applicantName,",",m.applicationTime,i.tab==="initiated"?`,${ae(m.processStatus)}`:"","。"]}),a.jsxs(e,{htmlType:"button",variant:"text",onClick:()=>M(m),children:["打开 ",m.applicationNo||m.applicationType," 的审批详情"]})]},m.id))]})]})},Pe=[],Ie=(e,t,i,R)=>{const[z,M]=c.useState(0),[E,v]=c.useState(),x=c.useRef({provider:e,logger:R});x.current={provider:e,logger:R};const w=c.useMemo(()=>({}),[t,i,z]);c.useEffect(()=>{const d=new AbortController,{provider:j,logger:h}=x.current,S={operation:"list",tab:t.tab,page:t.page,pageSize:t.pageSize};A(h,{...S,phase:"start"});let L=!1;return(async()=>{try{if(await Promise.resolve(),d.signal.aborted)return;const N=await j.loadPage(t,{signal:d.signal});if(d.signal.aborted)return;const p=Q(N,t.pageSize);L=!0,v({...p,token:w,status:"success"}),A(h,{...S,phase:"success",rowCount:p.rows.length})}catch{if(d.signal.aborted)return;L=!0,v({token:w,status:"error",rows:Pe,total:0}),A(h,{...S,phase:"error"})}})(),()=>{d.abort(),L||A(h,{...S,phase:"cancel"})}},[t,w]);const P=E?.token===w?E:void 0;return{initialPage:P?.status==="success"?P:void 0,total:P?.total??0,status:P?.status??"loading",reload:()=>M(d=>d+1)}},J={keyword:"",applicantId:"",processStatus:"",startDate:"",endDate:""},ue=["pending","approved"],he={pending:"待处理",approved:"已完成",initiated:"已发起"},G=e=>{if(e==="")return!0;if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;const t=new Date(`${e}T00:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e},ze=({components:e,provider:t,onOpenApproval:i,applicantOptions:R=[],pageSize:z=20,refreshKey:M,themeKey:E,logger:v,className:x,presentation:w="desktop",tabs:P=ue})=>{const{Input:d,Select:j,DateRangePicker:h,Button:S,Tabs:L}=e,N=c.useId(),[p,C]=c.useState(J),[D,s]=c.useState(0),[f,u]=c.useState(""),[m,T]=c.useState(""),[B,O]=c.useState({...J,tab:P[0],page:1,pageSize:z}),{initialPage:o,status:r,reload:g}=Ie(t,B,M,v),k=c.useRef(!1),V=c.useRef(!0);c.useEffect(()=>(V.current=!0,()=>{V.current=!1}),[]);const b=r==="loading",$=async n=>{if(!k.current){k.current=!0,T(""),A(v,{operation:"open",phase:"start"});try{await i(n),A(v,{operation:"open",phase:"success"})}catch{V.current&&T("审批详情打开失败,请重试"),A(v,{operation:"open",phase:"error"})}finally{k.current=!1}}},Y=n=>{n===B.tab||!P.includes(n)||(u(""),T(""),n==="initiated"&&C(l=>({...l,keyword:"",applicantId:"",processStatus:""})),O(l=>({...l,...n==="initiated"?{keyword:"",applicantId:"",processStatus:""}:{},tab:n,page:1})))},W=n=>{C(l=>({...l,...n})),w==="mobile"&&(u(""),T(""),O(l=>({...l,...n,page:1})))};return a.jsx("section",{className:["make-app-approval",w==="mobile"&&"make-app-approval--mobile",x].filter(Boolean).join(" "),"aria-label":"我的审批",children:a.jsxs(L,{items:P.map(n=>({value:n,label:he[n]})),value:B.tab,onChange:Y,ariaLabel:"审批分类",children:[a.jsxs("form",{className:"make-app-approval-filters",onSubmit:n=>{if(n.preventDefault(),w==="mobile"){u(""),T(""),O(l=>({...l,keyword:p.keyword.trim(),page:1}));return}if(!G(p.startDate)||!G(p.endDate)){u("请选择有效日期");return}if(p.startDate&&p.endDate&&p.startDate>p.endDate){u("开始日期不能晚于结束日期");return}u(""),T(""),O(l=>({...l,...p,keyword:p.keyword.trim(),page:1}))},children:[B.tab!=="initiated"&&a.jsxs("div",{className:"make-app-approval-filter-field",children:[w==="mobile"&&a.jsx(S,{htmlType:"submit",variant:"text",ariaLabel:"搜索申请单ID",children:a.jsxs("svg",{"aria-hidden":"true",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[a.jsx("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),a.jsx("path",{d:"m16 16 5 5"})]})}),a.jsx(d,{id:`${N}-keyword`,ariaLabel:"申请单ID",placeholder:"搜索申请单ID",value:p.keyword,onChange:n=>{C(l=>({...l,keyword:n})),w==="mobile"&&!n&&O(l=>({...l,keyword:"",page:1}))}})]}),a.jsx("div",{className:"make-app-approval-date-control",children:a.jsx(h,{id:`${N}-period`,ariaLabel:"申请时间",placeholder:["开始日期","结束日期"],value:[p.startDate,p.endDate],onChange:([n,l])=>{if(w==="mobile"&&(!G(n)||!G(l)||n&&l&&n>l)){u("请选择有效日期范围");return}if(w==="mobile"&&!!n!=!!l){C(F=>({...F,startDate:n,endDate:l}));return}W({startDate:n,endDate:l})}},D)}),B.tab!=="initiated"&&a.jsx("div",{className:"make-app-approval-filter-field",children:a.jsx(j,{id:`${N}-applicant`,ariaLabel:"申请人",purpose:"applicant",value:p.applicantId??"",options:[{value:"",label:"全部申请人"},...R.filter(n=>n.value!=="")],onChange:n=>W({applicantId:n})})}),w!=="mobile"&&a.jsxs("div",{className:"make-app-approval-filter-actions",children:[a.jsx(S,{htmlType:"submit",variant:"primary",children:"查询"}),a.jsx(S,{htmlType:"button",variant:"default",onClick:()=>{C(J),s(n=>n+1),u(""),T(""),O(n=>({...n,...J,page:1}))},children:"重置"}),a.jsx(S,{htmlType:"button",variant:"default",disabled:b,loading:b,onClick:g,children:"刷新"})]})]}),f&&a.jsx("p",{role:"alert",className:"make-app-approval-error",children:f}),m&&a.jsx("p",{role:"alert",className:"make-app-approval-error",children:m}),a.jsxs("div",{className:"make-app-approval-results","aria-busy":b,children:[w==="mobile"?o&&a.jsx(Ne,{initialPage:o,query:B,provider:t,onReload:g,components:e,onOpen:n=>{$(n)},logger:v},JSON.stringify([B,M,o])):a.jsx(Ce,{components:e,initialPage:o,query:B,provider:t,onOpen:n=>{$(n)},onReload:g,themeKey:E,logger:v}),b&&a.jsx("div",{className:"make-app-approval-overlay",role:"status",children:"正在加载审批记录…"}),r==="error"&&a.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:[a.jsx("span",{children:"审批列表加载失败,请重试"}),a.jsx(S,{htmlType:"button",variant:"default",onClick:g,children:"重试"})]})]})]})})},Ae=e=>{const t=e.pageSize??20,i=e.tabs??ue;if(!i.length||new Set(i).size!==i.length||i.some(R=>!Object.hasOwn(he,R)))throw new Error("MyApprovalsPage requires valid unique tabs");if(!e.scopeKey.trim())throw new Error("MyApprovalsPage requires scopeKey");for(const R of["Input","Select","DateRangePicker","Button","Tabs"])if(!e.components?.[R])throw new Error(`MyApprovalsPage requires components.${R}`);if(!Number.isSafeInteger(t)||t<1||t>200)throw new Error("pageSize must be an integer from 1 to 200");return a.jsx(ze,{...e,tabs:i,pageSize:t},JSON.stringify([e.scopeKey,t,i]))};exports.MyApprovalsPage=Ae;
1
+ "use strict";var ge=Object.create;var ne=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var ye=(e,t,i,R)=>{if(t&&typeof t=="object"||typeof t=="function")for(let z of be(t))!ke.call(e,z)&&z!==i&&ne(e,z,{get:()=>t[z],enumerable:!(R=ve(t,z))||R.enumerable});return e};var xe=(e,t,i)=>(i=e!=null?ge(we(e)):{},ye(t||!e||!e.__esModule?ne(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),c=require("react"),Se=require("./index.cjs"),de=e=>typeof e=="object"&&e!==null,je=e=>de(e)?["id","entityKey","recordId"].every(t=>typeof e[t]=="string"&&e[t].trim().length>0)&&["applicationNo","applicationType","applicantName","applicationTime"].every(t=>typeof e[t]=="string")&&["taskId","processInstanceId"].every(t=>e[t]===void 0||typeof e[t]=="string"&&e[t].trim().length>0)&&["completionTime","completionResult"].every(t=>e[t]===void 0||typeof e[t]=="string")&&(e.referenceType===void 0||e.referenceType==="task"||e.referenceType==="instance")&&(e.referenceType!=="instance"||typeof e.processInstanceId=="string"&&e.processInstanceId.trim().length>0)&&(typeof e.processStatus=="string"||e.processStatus===null):!1,Q=(e,t)=>{if(!de(e)||!Array.isArray(e.rows)||!e.rows.every(je)||typeof e.total!="number"||!Number.isSafeInteger(e.total)||e.total<0||e.rows.length>t||e.rows.length>e.total||new Set(e.rows.map(i=>i.id)).size!==e.rows.length)throw new Error("Invalid approval page contract");return{rows:e.rows,total:e.total}},A=(e,t)=>{try{e?e(t):t.phase==="error"?console.warn("[make-app-approval]",t):console.info("[make-app-approval]",t)}catch{console.warn("[make-app-approval] diagnostic sink failed")}},ae=e=>e==null||e==="UNSUBMITTED"?"状态未知":Se.getApprovalStatusDisplay(e).label,Ne=({initialPage:e,query:t,provider:i,components:R,onOpen:z,onReload:M,logger:E})=>{const[v,x]=c.useState(e),[w,P]=c.useState(2),[d,j]=c.useState("idle"),u=c.useRef(void 0),[S,L]=c.useState(!1),N=c.useRef(void 0);c.useEffect(()=>()=>{N.current?.abort()},[]);const p=async()=>{if(N.current||v.rows.length>=v.total)return;const s=new AbortController;N.current=s,j("loading");const f={operation:"list",tab:t.tab,page:w,pageSize:t.pageSize};A(E,{...f,phase:"start"});try{const h=Q(await i.loadPage({...t,page:w},{signal:s.signal}),t.pageSize);if(s.signal.aborted)return;if(h.total<v.total){A(E,{...f,phase:"skip",rowCount:h.rows.length}),M();return}const m=new Set(v.rows.map(T=>T.id));if(!h.rows.length||h.rows.some(T=>m.has(T.id)))throw new Error("Invalid append page");x({rows:[...v.rows,...h.rows],total:h.total}),P(T=>T+1),j("idle"),A(E,{...f,phase:"success",rowCount:h.rows.length})}catch{s.signal.aborted||(j("error"),A(E,{...f,phase:"error"}))}finally{N.current===s&&(N.current=void 0)}},C=s=>{const{scrollHeight:f,scrollTop:h,clientHeight:m}=s.currentTarget;d==="idle"&&f-h-m<120&&p()},{Button:D}=R;return a.jsxs("div",{className:"make-app-approval-mobile-list",onScroll:C,onTouchStart:s=>{u.current=s.currentTarget.scrollTop<=0&&s.touches.length===1&&d!=="loading"?{start:s.touches[0].clientY,distance:0}:void 0},onTouchMove:s=>{!u.current||s.touches.length!==1||(u.current.distance=s.touches[0].clientY-u.current.start,L(u.current.distance>=60))},onTouchEnd:()=>{const s=(u.current?.distance??0)>=60;u.current=void 0,L(!1),s&&M()},onTouchCancel:()=>{u.current=void 0,L(!1)},"aria-label":"审批卡片列表","aria-busy":d==="loading",children:[S&&a.jsx("p",{role:"status",className:"make-app-approval-mobile-feedback",children:"松开刷新"}),v.rows.map(s=>a.jsxs("button",{type:"button",className:"make-app-approval-mobile-card",onClick:()=>z(s),"aria-label":`打开 ${s.applicationNo} 的审批详情`,children:[a.jsx("strong",{children:s.applicationType||"审批申请"}),a.jsxs("span",{className:"make-app-approval-mobile-card-line",children:[a.jsx("span",{children:"申请单ID:"}),a.jsx("span",{children:s.applicationNo})]}),t.tab==="approved"&&a.jsxs("span",{className:"make-app-approval-mobile-card-line",children:[a.jsx("span",{children:"审批结果:"}),a.jsx("span",{children:s.completionResult||"—"})]}),t.tab==="initiated"&&a.jsxs("span",{className:"make-app-approval-mobile-card-line",children:[a.jsx("span",{children:"流程状态:"}),a.jsx("span",{children:ae(s.processStatus)})]}),a.jsxs("span",{className:"make-app-approval-mobile-card-footer",children:[a.jsxs("span",{className:"make-app-approval-mobile-person",children:[a.jsx("span",{className:"make-app-approval-mobile-avatar","aria-hidden":"true",children:s.applicantName.slice(-2)}),a.jsx("span",{children:s.applicantName||"—"})]}),a.jsx("span",{children:t.tab==="approved"?`完成于 ${s.completionTime||"—"}`:`申请于 ${s.applicationTime||"—"}`})]})]},s.id)),!v.rows.length&&a.jsx("p",{className:"make-app-approval-mobile-feedback",children:"暂无审批记录"}),d==="error"?a.jsxs("div",{role:"alert",className:"make-app-approval-mobile-feedback",children:["部分审批记录加载失败",a.jsx(D,{htmlType:"button",variant:"text",onClick:()=>{p()},children:"重试加载"})]}):d==="loading"?a.jsx("p",{role:"status",className:"make-app-approval-mobile-feedback",children:"加载中"}):v.rows.length<v.total?a.jsx(D,{htmlType:"button",variant:"text",onClick:()=>{p()},children:"加载更多"}):v.rows.length>0&&a.jsx("p",{className:"make-app-approval-mobile-feedback",children:"没有更多了"})]})},Te={applicationNo:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-fingerprint-pattern" aria-hidden="true"><path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"></path><path d="M14 13.12c0 2.38 0 6.38-1 8.88"></path><path d="M17.29 21.02c.12-.6.43-2.3.5-3.02"></path><path d="M2 12a10 10 0 0 1 18-6"></path><path d="M2 16h.01"></path><path d="M21.8 16c.2-2 .131-5.354 0-6"></path><path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"></path><path d="M8.65 22c.21-.66.45-1.32.57-2"></path><path d="M9 6.8a6 6 0 0 1 9 5.2v2"></path></svg>',applicationType:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-type" aria-hidden="true"><path d="M12 4v16"></path><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"></path><path d="M9 20h6"></path></svg>',applicantName:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-round" aria-hidden="true"><circle cx="12" cy="8" r="5"></circle><path d="M20 21a8 8 0 0 0-16 0"></path></svg>',applicationTime:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-calendar-clock" aria-hidden="true"><path d="M16 14v2.2l1.6 1"></path><path d="M16 2v3"></path><path d="M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338"></path><path d="M3 9h5.859"></path><path d="M8 2v3"></path><circle cx="16" cy="16" r="6"></circle></svg>'},ie=Object.fromEntries(Object.entries(Te).map(([e,t])=>[e,`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`])),te=64,le=[{key:"applicationNo",title:"申请单ID",width:260},{key:"applicationType",title:"业务表单",width:180},{key:"applicantName",title:"申请人",width:170},{key:"applicationTime",title:"申请时间",width:220}],ce=(e,t)=>{const i=t==="initiated"?[...le,{key:"statusLabel",title:"流程状态",width:140}]:le,R=i.reduce((M,E)=>M+E.width,te),z=Math.max(0,e-R)/i.length;return i.map(M=>({...M,width:M.width+z,showEllipsis:!0,sortable:!1,prefixRender:()=>({icon:ie[M.key]??ie.applicationType})}))},Re=({table:e,query:t,initialPage:i,loadPage:R,onChange:z,retryViewport:M,onReload:E,logger:v})=>{const x=new Map,w=new Set;let P=[];const d=new WeakMap,j=new Set;let u=i,S=i.total,L=0,N=!1,p=!1,C;const D=o=>Number.isSafeInteger(o)&&o>=0&&o*t.pageSize<S,s=(o,r,g)=>A(v,{operation:"list",phase:r,tab:t.tab,page:o+1,pageSize:t.pageSize,rowCount:g}),f=()=>{N||z({total:S,rows:P,failed:p||j.size>0,loading:x.size>0})},h=o=>{o.finished||(o.finished=!0,o.removeAbort(),x.get(o.page)===o&&x.delete(o.page),e.markPageLoadFailed(o.page,o.request),o.controller.abort(),s(o.page,"cancel"))},m=o=>{L=o;const r=e.getPagesInView()??[],g=new Set([L,...r].flatMap(k=>[k-1,k,k+1]).filter(D));for(const k of x.values())g.has(k.page)||h(k);for(const k of j)g.has(k)||j.delete(k)},T=(o,r,g)=>{const k=r.rows.map(b=>{const H={...b,statusLabel:ae(b.processStatus)};return d.set(H,b),H});if(!e.setVirtualPageData(k,o,r.total,g)){s(o,"skip");return}S=r.total;try{P=Q({rows:e.getTableData()??[],total:S},Number.MAX_SAFE_INTEGER).rows.map(b=>d.get(b)??b)}catch(b){p=!0,P=[],u=void 0,C&&clearTimeout(C),C=void 0;for(const H of x.values())h(H);throw b}u&&u.total!==S&&(u=void 0),j.delete(o);for(const b of x.values())D(b.page)||h(b);!D(o)&&o>0&&e.scrollToRow(Math.max(0,S-1)),s(o,"success",r.rows.length)},B=()=>{if(N||C)return;const o=[...x.values()].filter(r=>!r.running&&!r.finished).sort((r,g)=>Math.abs(r.page-L)-Math.abs(g.page-L)||r.page-g.page);for(const r of o){if(w.size>=2)break;r.running=!0,w.add(r),s(r.page,"start"),(async()=>{try{const g=await R({...t,page:r.page+1},{signal:r.controller.signal});if(N||r.finished||r.controller.signal.aborted)return;const k=Q(g,t.pageSize);r.finished=!0,r.removeAbort(),x.delete(r.page),T(r.page,k,r.request)}catch{!N&&!r.controller.signal.aborted&&(j.add(r.page),s(r.page,"error"),e.markPageLoadFailed(r.page,r.request))}finally{r.finished||(r.finished=!0,r.removeAbort(),x.get(r.page)===r&&x.delete(r.page)),w.delete(r),f(),B()}})()}f()},O=()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=void 0,B()},120)};return{load(o,r){if(r.useRequestIdentity(),N||p||r.signal.aborted||!D(o)){e.markPageLoadFailed(o,r),s(o,"skip");return}const g=x.get(o);if(g?.request===r&&!g.finished)return;if(g&&h(g),m(o),o===0&&u){const b=u;u=void 0;try{T(0,b,r)}catch{j.add(o),e.markPageLoadFailed(o,r),s(o,"error")}f();return}const k={page:o,request:r,controller:new AbortController,running:!1,finished:!1,removeAbort:()=>{}},V=()=>{h(k),f()};r.signal.addEventListener("abort",V,{once:!0}),k.removeAbort=()=>r.signal.removeEventListener("abort",V),x.set(o,k),O(),f()},viewportChanged(){if(N)return;const o=e.getPagesInView();o?.length&&(m(o[0]),x.size&&O(),f())},retry(){if(!N){if(p){E();return}j.size!==0&&(j.clear(),M(),f())}},dispose(){N=!0,C&&clearTimeout(C),C=void 0;for(const o of x.values())h(o);P=[],j.clear(),u=void 0}}},pe=40,Ce=e=>{const t=c.useRef(void 0);return e.initialPage?a.jsx(Me,{...e,initialPage:e.initialPage,restoreScroll:t.current?.query===e.query?t.current.position:void 0,rememberScroll:i=>{t.current={query:e.query,position:i}}}):a.jsx("div",{className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"})},Me=({components:{Button:e},initialPage:t,query:i,provider:R,themeKey:z,onOpen:M,onReload:E,logger:v,restoreScroll:x,rememberScroll:w})=>{const P=c.useRef(null),d=c.useRef(null),j=c.useRef(null),[u,S]=c.useState(!1),[L,N]=c.useState(0),[p,C]=c.useState({...t,failed:!1,loading:!1}),D=c.useRef(t.rows),s=c.useRef(x),f=c.useRef({provider:R,onOpen:M,onReload:E,logger:v,rememberScroll:w});f.current={provider:R,onOpen:M,onReload:E,logger:v,rememberScroll:w};const h=c.useRef(()=>{});return c.useEffect(()=>{const m=P.current;if(!m)return;let T=!1,B,O,o,r,g,k=t.total;A(f.current.logger,{operation:"table",phase:"start"});const V=()=>{T||(S(!0),A(f.current.logger,{operation:"table",phase:"error"}))};return import("@qfei-design/canvas-table").then(b=>{if(T)return;const H=()=>{const n=d.current,l=n?.getScrollState();n&&l&&b.globalEventBus.emitWithNamespace("scroll:change",n.tableId,l)},Y=(n=!1)=>{if(!T)try{const{width:l,height:W}=m.getBoundingClientRect();if(l<=0||W<=0||!n&&g?.width===l&&g.height===W)return;const $=getComputedStyle(m),re={rowHeight:pe,headerHeight:40,fontSize:14,fontFamily:$.fontFamily||"Arial, sans-serif",...$.color?{textColor:$.color}:{},...$.getPropertyValue("--make-approval-bg").trim()?{rowBgColor:$.getPropertyValue("--make-approval-bg").trim()}:{},...$.getPropertyValue("--make-approval-header").trim()?{headerBgColor:$.getPropertyValue("--make-approval-header").trim()}:{},...$.getPropertyValue("--make-approval-border").trim()?{borderColor:$.getPropertyValue("--make-approval-border").trim()}:{}},fe=Math.max(Math.ceil(300/i.pageSize),Math.ceil(W*3/pe/i.pageSize)+2)*i.pageSize,oe={enabled:!0,totalRowCount:k,pageSize:i.pageSize,maxCachedRows:fe};if(d.current){const y=g?.width!==l?ce(l,i.tab):void 0;if(d.current.updateProps({canvasWidth:l,canvasHeight:W,style:re,virtualOptions:oe,...y?{columns:y}:{}}),y){const I=d.current.getScrollState(),K=Math.max(0,y.reduce((U,q)=>U+q.width,te)-l);I&&I.scrollX>K&&d.current.scrollTo(K,I.scrollY,!1)}g={width:l,height:W},H();return}d.current=new b.CanvasTableComponent(m,{columns:ce(l,i.tab),canvasWidth:l,canvasHeight:W,style:re,rowKey:"id",minCanvasWidth:0,minCanvasHeight:0,showSN:{enabled:!0,width:te,formatter:(y,I)=>I+1},virtualOptions:oe,selectable:{enabled:!1},rowSortable:{enabled:!1},editApplyMode:"controlled",customEdit:y=>{y.cancel()},emptyStateOptions:{text:"暂无审批记录"},bodyRowHeadSuffixOptions:{enabled:!0,width:20,render:({group:y,x:I,height:K,rowData:U})=>{const q=U?.id,_=new b.RectShape({name:"approval-open",x:I,y:K/2-10,cursor:"pointer",tooltip:"查看审批详情",attrs:{width:20,height:20,fill:"transparent",stroke:"transparent"}});_.addChild(new b.ImgShape({name:"approval-open-icon",x:3,y:3,attrs:{width:14,height:14,img:"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${$.color||"#64748b"}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)}})),_.on("mousedown",ee=>ee.stopPropagation?.()),_.on("click",ee=>{ee.stopPropagation?.();const se=D.current.find(me=>me.id===q);se&&f.current.onOpen(se)}),y.addChild(_)}}});const X=d.current;g={width:l,height:W};const Z=Re({table:X,query:i,initialPage:t,retryViewport:H,onReload:()=>f.current.onReload(),loadPage:(y,I)=>f.current.provider.loadPage(y,I),logger:y=>A(f.current.logger,y),onChange:y=>{T||(k=y.total,D.current=y.rows,C(I=>I.total===y.total&&I.failed===y.failed&&I.loading===y.loading&&I.rows.length===y.rows.length&&I.rows.every((K,U)=>K===y.rows[U])?I:y))}});j.current=Z,O=b.globalEventBus.onWithNamespace("data:load",X.tableId,(y,I)=>Z.load(y,I)),o=b.globalEventBus.onWithNamespace("scroll:change",X.tableId,()=>Z.viewportChanged()),s.current&&X.scrollTo(s.current.scrollX,s.current.scrollY),S(!1),A(f.current.logger,{operation:"table",phase:"success"})}catch{V()}};h.current=()=>Y(!0);const F=()=>Y();B=new ResizeObserver(F),B.observe(m),window.addEventListener("resize",F),r=()=>window.removeEventListener("resize",F),Y()}).catch(V),()=>{T=!0,B?.disconnect(),r?.(),h.current=()=>{},d.current&&(s.current=d.current.getScrollState(),s.current&&f.current.rememberScroll(s.current)),O?.(),o?.(),j.current?.dispose(),j.current=null,d.current?.destroy(),d.current=null,A(f.current.logger,{operation:"table",phase:"destroy"})}},[t,i,L]),c.useEffect(()=>{h.current()},[z]),a.jsxs("div",{className:"make-app-approval-table-frame","aria-busy":p.loading,children:[a.jsx("div",{ref:P,className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"}),u&&a.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:["表格加载失败 ",a.jsx(e,{htmlType:"button",variant:"default",onClick:()=>{S(!1),N(m=>m+1)},children:"重新加载表格"})]}),!u&&p.failed&&a.jsxs("div",{className:"make-app-approval-table-feedback",role:"alert",children:["部分审批记录加载失败 ",a.jsx(e,{htmlType:"button",variant:"default",onClick:()=>j.current?.retry(),children:"重试加载"})]}),!u&&!p.failed&&p.loading&&a.jsxs("div",{className:"make-app-approval-table-loading",role:"status","aria-label":"正在加载审批记录","aria-live":"polite",children:[a.jsx("span",{className:"make-app-approval-loading-spinner","aria-hidden":"true"}),a.jsx("span",{children:"加载中"})]}),a.jsxs("ul",{className:"make-app-approval-accessible-rows","aria-label":"审批记录文字视图",children:[p.total===0&&a.jsx("li",{children:"暂无审批记录"}),p.rows.map(m=>a.jsxs("li",{children:[a.jsxs("span",{children:[m.applicationNo,",",m.applicationType,",",m.applicantName,",",m.applicationTime,i.tab==="initiated"?`,${ae(m.processStatus)}`:"","。"]}),a.jsxs(e,{htmlType:"button",variant:"text",onClick:()=>M(m),children:["打开 ",m.applicationNo||m.applicationType," 的审批详情"]})]},m.id))]})]})},Pe=[],Ie=(e,t,i,R)=>{const[z,M]=c.useState(0),[E,v]=c.useState(),x=c.useRef({provider:e,logger:R});x.current={provider:e,logger:R};const w=c.useMemo(()=>({}),[t,i,z]);c.useEffect(()=>{const d=new AbortController,{provider:j,logger:u}=x.current,S={operation:"list",tab:t.tab,page:t.page,pageSize:t.pageSize};A(u,{...S,phase:"start"});let L=!1;return(async()=>{try{if(await Promise.resolve(),d.signal.aborted)return;const N=await j.loadPage(t,{signal:d.signal});if(d.signal.aborted)return;const p=Q(N,t.pageSize);L=!0,v({...p,token:w,status:"success"}),A(u,{...S,phase:"success",rowCount:p.rows.length})}catch{if(d.signal.aborted)return;L=!0,v({token:w,status:"error",rows:Pe,total:0}),A(u,{...S,phase:"error"})}})(),()=>{d.abort(),L||A(u,{...S,phase:"cancel"})}},[t,w]);const P=E?.token===w?E:void 0;return{initialPage:P?.status==="success"?P:void 0,total:P?.total??0,status:P?.status??"loading",reload:()=>M(d=>d+1)}},J={keyword:"",applicantId:"",processStatus:"",startDate:"",endDate:""},he=["pending","approved"],ue={pending:"待处理",approved:"已完成",initiated:"已发起"},G=e=>{if(e==="")return!0;if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;const t=new Date(`${e}T00:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e},ze=({components:e,provider:t,onOpenApproval:i,applicantOptions:R=[],pageSize:z=20,refreshKey:M,themeKey:E,logger:v,className:x,presentation:w="desktop",tabs:P=he})=>{const{Input:d,Select:j,DateRangePicker:u,Button:S,Tabs:L}=e,N=c.useId(),[p,C]=c.useState(J),[D,s]=c.useState(0),[f,h]=c.useState(""),[m,T]=c.useState(""),[B,O]=c.useState({...J,tab:P[0],page:1,pageSize:z}),{initialPage:o,status:r,reload:g}=Ie(t,B,M,v),k=c.useRef(!1),V=c.useRef(!0);c.useEffect(()=>(V.current=!0,()=>{V.current=!1}),[]);const b=r==="loading",H=async n=>{if(!k.current){k.current=!0,T(""),A(v,{operation:"open",phase:"start"});try{await i(n),A(v,{operation:"open",phase:"success"})}catch{V.current&&T("审批详情打开失败,请重试"),A(v,{operation:"open",phase:"error"})}finally{k.current=!1}}},Y=n=>{n===B.tab||!P.includes(n)||(h(""),T(""),n==="initiated"&&C(l=>({...l,keyword:"",applicantId:"",processStatus:""})),O(l=>({...l,...n==="initiated"?{keyword:"",applicantId:"",processStatus:""}:{},tab:n,page:1})))},F=n=>{C(l=>({...l,...n})),w==="mobile"&&(h(""),T(""),O(l=>({...l,...n,page:1})))};return a.jsx("section",{className:["make-app-approval",w==="mobile"&&"make-app-approval--mobile",x].filter(Boolean).join(" "),"aria-label":"我的审批",children:a.jsxs(L,{items:P.map(n=>({value:n,label:ue[n]})),value:B.tab,onChange:Y,ariaLabel:"审批分类",children:[a.jsxs("form",{className:"make-app-approval-filters",onSubmit:n=>{if(n.preventDefault(),w==="mobile"){h(""),T(""),O(l=>({...l,keyword:p.keyword.trim(),page:1}));return}if(!G(p.startDate)||!G(p.endDate)){h("请选择有效日期");return}if(p.startDate&&p.endDate&&p.startDate>p.endDate){h("开始日期不能晚于结束日期");return}h(""),T(""),O(l=>({...l,...p,keyword:p.keyword.trim(),page:1}))},children:[B.tab!=="initiated"&&a.jsxs("div",{className:"make-app-approval-filter-field",children:[w==="mobile"&&a.jsx(S,{htmlType:"submit",variant:"text",ariaLabel:"搜索申请单ID",children:a.jsxs("svg",{"aria-hidden":"true",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[a.jsx("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),a.jsx("path",{d:"m16 16 5 5"})]})}),a.jsx(d,{id:`${N}-keyword`,ariaLabel:"申请单ID",placeholder:"搜索申请单ID",value:p.keyword,onChange:n=>{C(l=>({...l,keyword:n})),w==="mobile"&&!n&&O(l=>({...l,keyword:"",page:1}))}})]}),a.jsx("div",{className:"make-app-approval-date-control",children:a.jsx(u,{id:`${N}-period`,ariaLabel:"申请时间",placeholder:["开始日期","结束日期"],value:[p.startDate,p.endDate],onChange:([n,l])=>{if(w==="mobile"&&(!G(n)||!G(l)||n&&l&&n>l)){h("请选择有效日期范围");return}if(w==="mobile"&&!!n!=!!l){C(W=>({...W,startDate:n,endDate:l}));return}F({startDate:n,endDate:l})}},D)}),B.tab!=="initiated"&&a.jsx("div",{className:"make-app-approval-filter-field",children:a.jsx(j,{id:`${N}-applicant`,ariaLabel:"申请人",purpose:"applicant",value:p.applicantId??"",options:[{value:"",label:"全部申请人"},...R.filter(n=>n.value!=="")],onChange:n=>F({applicantId:n})})}),w!=="mobile"&&a.jsxs("div",{className:"make-app-approval-filter-actions",children:[a.jsx(S,{htmlType:"submit",variant:"primary",children:"查询"}),a.jsx(S,{htmlType:"button",variant:"default",onClick:()=>{C(J),s(n=>n+1),h(""),T(""),O(n=>({...n,...J,page:1}))},children:"重置"}),a.jsx(S,{htmlType:"button",variant:"default",disabled:b,loading:b,onClick:g,children:"刷新"})]})]}),f&&a.jsx("p",{role:"alert",className:"make-app-approval-error",children:f}),m&&a.jsx("p",{role:"alert",className:"make-app-approval-error",children:m}),a.jsxs("div",{className:"make-app-approval-results","aria-busy":b,children:[w==="mobile"?o&&a.jsx(Ne,{initialPage:o,query:B,provider:t,onReload:g,components:e,onOpen:n=>{H(n)},logger:v},JSON.stringify([B,M,o])):a.jsx(Ce,{components:e,initialPage:o,query:B,provider:t,onOpen:n=>{H(n)},onReload:g,themeKey:E,logger:v}),b&&a.jsx("div",{className:"make-app-approval-overlay",role:"status",children:"正在加载审批记录…"}),r==="error"&&a.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:[a.jsx("span",{children:"审批列表加载失败,请重试"}),a.jsx(S,{htmlType:"button",variant:"default",onClick:g,children:"重试"})]})]})]})})},Ae=e=>{const t=e.pageSize??20,i=e.tabs??he;if(!i.length||new Set(i).size!==i.length||i.some(R=>!Object.hasOwn(ue,R)))throw new Error("MyApprovalsPage requires valid unique tabs");if(!e.scopeKey.trim())throw new Error("MyApprovalsPage requires scopeKey");for(const R of["Input","Select","DateRangePicker","Button","Tabs"])if(!e.components?.[R])throw new Error(`MyApprovalsPage requires components.${R}`);if(!Number.isSafeInteger(t)||t<1||t>200)throw new Error("pageSize must be an integer from 1 to 200");return a.jsx(ze,{...e,tabs:i,pageSize:t},JSON.stringify([e.scopeKey,t,i]))};exports.MyApprovalsPage=Ae;
package/dist/list.mjs CHANGED
@@ -11,13 +11,13 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
11
11
  } catch {
12
12
  console.warn("[make-app-approval] diagnostic sink failed");
13
13
  }
14
- }, ne = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : ke(e).label, Se = ({ initialPage: e, query: t, provider: l, components: P, onOpen: H, onReload: I, logger: E }) => {
15
- const [g, y] = D(e), [b, x] = D(2), [p, T] = D("idle"), h = O(void 0), [S, L] = D(!1), C = O(void 0);
14
+ }, ne = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : ke(e).label, Se = ({ initialPage: e, query: t, provider: l, components: P, onOpen: $, onReload: I, logger: E }) => {
15
+ const [f, y] = D(e), [b, x] = D(2), [p, T] = D("idle"), h = O(void 0), [S, L] = D(!1), C = O(void 0);
16
16
  J(() => () => {
17
17
  C.current?.abort();
18
18
  }, []);
19
19
  const c = async () => {
20
- if (C.current || g.rows.length >= g.total) return;
20
+ if (C.current || f.rows.length >= f.total) return;
21
21
  const o = new AbortController();
22
22
  C.current = o, T("loading");
23
23
  const u = { operation: "list", tab: t.tab, page: b, pageSize: t.pageSize };
@@ -25,13 +25,13 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
25
25
  try {
26
26
  const d = ee(await l.loadPage({ ...t, page: b }, { signal: o.signal }), t.pageSize);
27
27
  if (o.signal.aborted) return;
28
- if (d.total < g.total) {
28
+ if (d.total < f.total) {
29
29
  A(E, { ...u, phase: "skip", rowCount: d.rows.length }), I();
30
30
  return;
31
31
  }
32
- const m = new Set(g.rows.map((M) => M.id));
32
+ const m = new Set(f.rows.map((M) => M.id));
33
33
  if (!d.rows.length || d.rows.some((M) => m.has(M.id))) throw new Error("Invalid append page");
34
- y({ rows: [...g.rows, ...d.rows], total: d.total }), x((M) => M + 1), T("idle"), A(E, { ...u, phase: "success", rowCount: d.rows.length });
34
+ y({ rows: [...f.rows, ...d.rows], total: d.total }), x((M) => M + 1), T("idle"), A(E, { ...u, phase: "success", rowCount: d.rows.length });
35
35
  } catch {
36
36
  o.signal.aborted || (T("error"), A(E, { ...u, phase: "error" }));
37
37
  } finally {
@@ -63,7 +63,7 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
63
63
  "aria-busy": p === "loading",
64
64
  children: [
65
65
  S && /* @__PURE__ */ n("p", { role: "status", className: "make-app-approval-mobile-feedback", children: "松开刷新" }),
66
- g.rows.map((o) => /* @__PURE__ */ N("button", { type: "button", className: "make-app-approval-mobile-card", onClick: () => H(o), "aria-label": `打开 ${o.applicationNo} 的审批详情`, children: [
66
+ f.rows.map((o) => /* @__PURE__ */ N("button", { type: "button", className: "make-app-approval-mobile-card", onClick: () => $(o), "aria-label": `打开 ${o.applicationNo} 的审批详情`, children: [
67
67
  /* @__PURE__ */ n("strong", { children: o.applicationType || "审批申请" }),
68
68
  /* @__PURE__ */ N("span", { className: "make-app-approval-mobile-card-line", children: [
69
69
  /* @__PURE__ */ n("span", { children: "申请单ID:" }),
@@ -85,15 +85,15 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
85
85
  /* @__PURE__ */ n("span", { children: t.tab === "approved" ? `完成于 ${o.completionTime || "—"}` : `申请于 ${o.applicationTime || "—"}` })
86
86
  ] })
87
87
  ] }, o.id)),
88
- !g.rows.length && /* @__PURE__ */ n("p", { className: "make-app-approval-mobile-feedback", children: "暂无审批记录" }),
88
+ !f.rows.length && /* @__PURE__ */ n("p", { className: "make-app-approval-mobile-feedback", children: "暂无审批记录" }),
89
89
  p === "error" ? /* @__PURE__ */ N("div", { role: "alert", className: "make-app-approval-mobile-feedback", children: [
90
90
  "部分审批记录加载失败",
91
91
  /* @__PURE__ */ n(V, { htmlType: "button", variant: "text", onClick: () => {
92
92
  c();
93
93
  }, children: "重试加载" })
94
- ] }) : p === "loading" ? /* @__PURE__ */ n("p", { role: "status", className: "make-app-approval-mobile-feedback", children: "加载中" }) : g.rows.length < g.total ? /* @__PURE__ */ n(V, { htmlType: "button", variant: "text", onClick: () => {
94
+ ] }) : p === "loading" ? /* @__PURE__ */ n("p", { role: "status", className: "make-app-approval-mobile-feedback", children: "加载中" }) : f.rows.length < f.total ? /* @__PURE__ */ n(V, { htmlType: "button", variant: "text", onClick: () => {
95
95
  c();
96
- }, children: "加载更多" }) : g.rows.length > 0 && /* @__PURE__ */ n("p", { className: "make-app-approval-mobile-feedback", children: "没有更多了" })
96
+ }, children: "加载更多" }) : f.rows.length > 0 && /* @__PURE__ */ n("p", { className: "make-app-approval-mobile-feedback", children: "没有更多了" })
97
97
  ]
98
98
  }
99
99
  );
@@ -110,34 +110,34 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
110
110
  { key: "applicantName", title: "申请人", width: 170 },
111
111
  { key: "applicationTime", title: "申请时间", width: 220 }
112
112
  ], de = (e, t) => {
113
- const l = t === "initiated" ? [...pe, { key: "statusLabel", title: "流程状态", width: 140 }] : pe, P = l.reduce((I, E) => I + E.width, oe), H = Math.max(0, e - P) / l.length;
113
+ const l = t === "initiated" ? [...pe, { key: "statusLabel", title: "流程状态", width: 140 }] : pe, P = l.reduce((I, E) => I + E.width, oe), $ = Math.max(0, e - P) / l.length;
114
114
  return l.map((I) => ({
115
115
  ...I,
116
- width: I.width + H,
116
+ width: I.width + $,
117
117
  showEllipsis: !0,
118
118
  sortable: !1,
119
119
  prefixRender: () => ({ icon: ce[I.key] ?? ce.applicationType })
120
120
  }));
121
- }, Te = ({ table: e, query: t, initialPage: l, loadPage: P, onChange: H, retryViewport: I, onReload: E, logger: g }) => {
121
+ }, Te = ({ table: e, query: t, initialPage: l, loadPage: P, onChange: $, retryViewport: I, onReload: E, logger: f }) => {
122
122
  const y = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Set();
123
123
  let x = [];
124
124
  const p = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new Set();
125
125
  let h = l, S = l.total, L = 0, C = !1, c = !1, R;
126
- const V = (r) => Number.isSafeInteger(r) && r >= 0 && r * t.pageSize < S, o = (r, a, f) => A(g, { operation: "list", phase: a, tab: t.tab, page: r + 1, pageSize: t.pageSize, rowCount: f }), u = () => {
127
- C || H({ total: S, rows: x, failed: c || T.size > 0, loading: y.size > 0 });
126
+ const V = (r) => Number.isSafeInteger(r) && r >= 0 && r * t.pageSize < S, o = (r, a, g) => A(f, { operation: "list", phase: a, tab: t.tab, page: r + 1, pageSize: t.pageSize, rowCount: g }), u = () => {
127
+ C || $({ total: S, rows: x, failed: c || T.size > 0, loading: y.size > 0 });
128
128
  }, d = (r) => {
129
129
  r.finished || (r.finished = !0, r.removeAbort(), y.get(r.page) === r && y.delete(r.page), e.markPageLoadFailed(r.page, r.request), r.controller.abort(), o(r.page, "cancel"));
130
130
  }, m = (r) => {
131
131
  L = r;
132
- const a = e.getPagesInView() ?? [], f = new Set([L, ...a].flatMap((w) => [w - 1, w, w + 1]).filter(V));
133
- for (const w of y.values()) f.has(w.page) || d(w);
134
- for (const w of T) f.has(w) || T.delete(w);
135
- }, M = (r, a, f) => {
132
+ const a = e.getPagesInView() ?? [], g = new Set([L, ...a].flatMap((w) => [w - 1, w, w + 1]).filter(V));
133
+ for (const w of y.values()) g.has(w.page) || d(w);
134
+ for (const w of T) g.has(w) || T.delete(w);
135
+ }, M = (r, a, g) => {
136
136
  const w = a.rows.map((v) => {
137
- const W = { ...v, statusLabel: ne(v.processStatus) };
138
- return p.set(W, v), W;
137
+ const F = { ...v, statusLabel: ne(v.processStatus) };
138
+ return p.set(F, v), F;
139
139
  });
140
- if (!e.setVirtualPageData(w, r, a.total, f)) {
140
+ if (!e.setVirtualPageData(w, r, a.total, g)) {
141
141
  o(r, "skip");
142
142
  return;
143
143
  }
@@ -146,7 +146,7 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
146
146
  x = ee({ rows: e.getTableData() ?? [], total: S }, Number.MAX_SAFE_INTEGER).rows.map((v) => p.get(v) ?? v);
147
147
  } catch (v) {
148
148
  c = !0, x = [], h = void 0, R && clearTimeout(R), R = void 0;
149
- for (const W of y.values()) d(W);
149
+ for (const F of y.values()) d(F);
150
150
  throw v;
151
151
  }
152
152
  h && h.total !== S && (h = void 0), T.delete(r);
@@ -154,14 +154,14 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
154
154
  !V(r) && r > 0 && e.scrollToRow(Math.max(0, S - 1)), o(r, "success", a.rows.length);
155
155
  }, B = () => {
156
156
  if (C || R) return;
157
- const r = [...y.values()].filter((a) => !a.running && !a.finished).sort((a, f) => Math.abs(a.page - L) - Math.abs(f.page - L) || a.page - f.page);
157
+ const r = [...y.values()].filter((a) => !a.running && !a.finished).sort((a, g) => Math.abs(a.page - L) - Math.abs(g.page - L) || a.page - g.page);
158
158
  for (const a of r) {
159
159
  if (b.size >= 2) break;
160
160
  a.running = !0, b.add(a), o(a.page, "start"), (async () => {
161
161
  try {
162
- const f = await P({ ...t, page: a.page + 1 }, { signal: a.controller.signal });
162
+ const g = await P({ ...t, page: a.page + 1 }, { signal: a.controller.signal });
163
163
  if (C || a.finished || a.controller.signal.aborted) return;
164
- const w = ee(f, t.pageSize);
164
+ const w = ee(g, t.pageSize);
165
165
  a.finished = !0, a.removeAbort(), y.delete(a.page), M(a.page, w, a.request);
166
166
  } catch {
167
167
  !C && !a.controller.signal.aborted && (T.add(a.page), o(a.page, "error"), e.markPageLoadFailed(a.page, a.request));
@@ -171,7 +171,7 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
171
171
  })();
172
172
  }
173
173
  u();
174
- }, $ = () => {
174
+ }, H = () => {
175
175
  R && clearTimeout(R), R = setTimeout(() => {
176
176
  R = void 0, B();
177
177
  }, 120);
@@ -182,9 +182,9 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
182
182
  e.markPageLoadFailed(r, a), o(r, "skip");
183
183
  return;
184
184
  }
185
- const f = y.get(r);
186
- if (f?.request === a && !f.finished) return;
187
- if (f && d(f), m(r), r === 0 && h) {
185
+ const g = y.get(r);
186
+ if (g?.request === a && !g.finished) return;
187
+ if (g && d(g), m(r), r === 0 && h) {
188
188
  const v = h;
189
189
  h = void 0;
190
190
  try {
@@ -196,15 +196,15 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
196
196
  return;
197
197
  }
198
198
  const w = { page: r, request: a, controller: new AbortController(), running: !1, finished: !1, removeAbort: () => {
199
- } }, F = () => {
199
+ } }, W = () => {
200
200
  d(w), u();
201
201
  };
202
- a.signal.addEventListener("abort", F, { once: !0 }), w.removeAbort = () => a.signal.removeEventListener("abort", F), y.set(r, w), $(), u();
202
+ a.signal.addEventListener("abort", W, { once: !0 }), w.removeAbort = () => a.signal.removeEventListener("abort", W), y.set(r, w), H(), u();
203
203
  },
204
204
  viewportChanged() {
205
205
  if (C) return;
206
206
  const r = e.getPagesInView();
207
- r?.length && (m(r[0]), y.size && $(), u());
207
+ r?.length && (m(r[0]), y.size && H(), u());
208
208
  },
209
209
  retry() {
210
210
  if (!C) {
@@ -234,29 +234,29 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
234
234
  }
235
235
  }
236
236
  ) : /* @__PURE__ */ n("div", { className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" });
237
- }, Me = ({ components: { Button: e }, initialPage: t, query: l, provider: P, themeKey: H, onOpen: I, onReload: E, logger: g, restoreScroll: y, rememberScroll: b }) => {
238
- const x = O(null), p = O(null), T = O(null), [h, S] = D(!1), [L, C] = D(0), [c, R] = D({ ...t, failed: !1, loading: !1 }), V = O(t.rows), o = O(y), u = O({ provider: P, onOpen: I, onReload: E, logger: g, rememberScroll: b });
239
- u.current = { provider: P, onOpen: I, onReload: E, logger: g, rememberScroll: b };
237
+ }, Me = ({ components: { Button: e }, initialPage: t, query: l, provider: P, themeKey: $, onOpen: I, onReload: E, logger: f, restoreScroll: y, rememberScroll: b }) => {
238
+ const x = O(null), p = O(null), T = O(null), [h, S] = D(!1), [L, C] = D(0), [c, R] = D({ ...t, failed: !1, loading: !1 }), V = O(t.rows), o = O(y), u = O({ provider: P, onOpen: I, onReload: E, logger: f, rememberScroll: b });
239
+ u.current = { provider: P, onOpen: I, onReload: E, logger: f, rememberScroll: b };
240
240
  const d = O(() => {
241
241
  });
242
242
  return J(() => {
243
243
  const m = x.current;
244
244
  if (!m) return;
245
- let M = !1, B, $, r, a, f, w = t.total;
245
+ let M = !1, B, H, r, a, g, w = t.total;
246
246
  A(u.current.logger, { operation: "table", phase: "start" });
247
- const F = () => {
247
+ const W = () => {
248
248
  M || (S(!0), A(u.current.logger, { operation: "table", phase: "error" }));
249
249
  };
250
250
  return import("@qfei-design/canvas-table").then((v) => {
251
251
  if (M) return;
252
- const W = () => {
252
+ const F = () => {
253
253
  const i = p.current, s = i?.getScrollState();
254
254
  i && s && v.globalEventBus.emitWithNamespace("scroll:change", i.tableId, s);
255
255
  }, X = (i = !1) => {
256
256
  if (!M)
257
257
  try {
258
258
  const { width: s, height: K } = m.getBoundingClientRect();
259
- if (s <= 0 || K <= 0 || !i && f?.width === s && f.height === K) return;
259
+ if (s <= 0 || K <= 0 || !i && g?.width === s && g.height === K) return;
260
260
  const j = getComputedStyle(m), ie = {
261
261
  rowHeight: he,
262
262
  headerHeight: 40,
@@ -266,9 +266,9 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
266
266
  ...j.getPropertyValue("--make-approval-bg").trim() ? { rowBgColor: j.getPropertyValue("--make-approval-bg").trim() } : {},
267
267
  ...j.getPropertyValue("--make-approval-header").trim() ? { headerBgColor: j.getPropertyValue("--make-approval-header").trim() } : {},
268
268
  ...j.getPropertyValue("--make-approval-border").trim() ? { borderColor: j.getPropertyValue("--make-approval-border").trim() } : {}
269
- }, ge = Math.max(Math.ceil(300 / l.pageSize), Math.ceil(K * 3 / he / l.pageSize) + 2) * l.pageSize, se = { enabled: !0, totalRowCount: w, pageSize: l.pageSize, maxCachedRows: ge };
269
+ }, fe = Math.max(Math.ceil(300 / l.pageSize), Math.ceil(K * 3 / he / l.pageSize) + 2) * l.pageSize, se = { enabled: !0, totalRowCount: w, pageSize: l.pageSize, maxCachedRows: fe };
270
270
  if (p.current) {
271
- const k = f?.width !== s ? de(s, l.tab) : void 0;
271
+ const k = g?.width !== s ? de(s, l.tab) : void 0;
272
272
  if (p.current.updateProps({
273
273
  canvasWidth: s,
274
274
  canvasHeight: K,
@@ -279,7 +279,7 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
279
279
  const z = p.current.getScrollState(), U = Math.max(0, k.reduce((_, ae) => _ + ae.width, oe) - s);
280
280
  z && z.scrollX > U && p.current.scrollTo(U, z.scrollY, !1);
281
281
  }
282
- f = { width: s, height: K }, W();
282
+ g = { width: s, height: K }, F();
283
283
  return;
284
284
  }
285
285
  p.current = new v.CanvasTableComponent(m, {
@@ -288,6 +288,8 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
288
288
  canvasHeight: K,
289
289
  style: ie,
290
290
  rowKey: "id",
291
+ minCanvasWidth: 0,
292
+ minCanvasHeight: 0,
291
293
  showSN: { enabled: !0, width: oe, formatter: (k, z) => z + 1 },
292
294
  virtualOptions: se,
293
295
  selectable: { enabled: !1 },
@@ -315,13 +317,13 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
315
317
  }
316
318
  });
317
319
  const G = p.current;
318
- f = { width: s, height: K };
320
+ g = { width: s, height: K };
319
321
  const te = Te({
320
322
  table: G,
321
323
  query: l,
322
324
  initialPage: t,
323
325
  // 公开滚动同步事件会重新检测缺页,不移动视口,也不复用失败身份。
324
- retryViewport: W,
326
+ retryViewport: F,
325
327
  onReload: () => u.current.onReload(),
326
328
  loadPage: (k, z) => u.current.provider.loadPage(k, z),
327
329
  logger: (k) => A(u.current.logger, k),
@@ -329,21 +331,21 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
329
331
  M || (w = k.total, V.current = k.rows, R((z) => z.total === k.total && z.failed === k.failed && z.loading === k.loading && z.rows.length === k.rows.length && z.rows.every((U, _) => U === k.rows[_]) ? z : k));
330
332
  }
331
333
  });
332
- T.current = te, $ = v.globalEventBus.onWithNamespace("data:load", G.tableId, (k, z) => te.load(k, z)), r = v.globalEventBus.onWithNamespace("scroll:change", G.tableId, () => te.viewportChanged()), o.current && G.scrollTo(o.current.scrollX, o.current.scrollY), S(!1), A(u.current.logger, { operation: "table", phase: "success" });
334
+ T.current = te, H = v.globalEventBus.onWithNamespace("data:load", G.tableId, (k, z) => te.load(k, z)), r = v.globalEventBus.onWithNamespace("scroll:change", G.tableId, () => te.viewportChanged()), o.current && G.scrollTo(o.current.scrollX, o.current.scrollY), S(!1), A(u.current.logger, { operation: "table", phase: "success" });
333
335
  } catch {
334
- F();
336
+ W();
335
337
  }
336
338
  };
337
339
  d.current = () => X(!0);
338
340
  const Y = () => X();
339
341
  B = new ResizeObserver(Y), B.observe(m), window.addEventListener("resize", Y), a = () => window.removeEventListener("resize", Y), X();
340
- }).catch(F), () => {
342
+ }).catch(W), () => {
341
343
  M = !0, B?.disconnect(), a?.(), d.current = () => {
342
- }, p.current && (o.current = p.current.getScrollState(), o.current && u.current.rememberScroll(o.current)), $?.(), r?.(), T.current?.dispose(), T.current = null, p.current?.destroy(), p.current = null, A(u.current.logger, { operation: "table", phase: "destroy" });
344
+ }, p.current && (o.current = p.current.getScrollState(), o.current && u.current.rememberScroll(o.current)), H?.(), r?.(), T.current?.dispose(), T.current = null, p.current?.destroy(), p.current = null, A(u.current.logger, { operation: "table", phase: "destroy" });
343
345
  };
344
346
  }, [t, l, L]), J(() => {
345
347
  d.current();
346
- }, [H]), /* @__PURE__ */ N("div", { className: "make-app-approval-table-frame", "aria-busy": c.loading, children: [
348
+ }, [$]), /* @__PURE__ */ N("div", { className: "make-app-approval-table-frame", "aria-busy": c.loading, children: [
347
349
  /* @__PURE__ */ n("div", { ref: x, className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" }),
348
350
  h && /* @__PURE__ */ N("div", { className: "make-app-approval-overlay", role: "alert", children: [
349
351
  "表格加载失败 ",
@@ -382,9 +384,9 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
382
384
  ] })
383
385
  ] });
384
386
  }, Re = [], Ie = (e, t, l, P) => {
385
- const [H, I] = D(0), [E, g] = D(), y = O({ provider: e, logger: P });
387
+ const [$, I] = D(0), [E, f] = D(), y = O({ provider: e, logger: P });
386
388
  y.current = { provider: e, logger: P };
387
- const b = be(() => ({}), [t, l, H]);
389
+ const b = be(() => ({}), [t, l, $]);
388
390
  J(() => {
389
391
  const p = new AbortController(), { provider: T, logger: h } = y.current, S = { operation: "list", tab: t.tab, page: t.page, pageSize: t.pageSize };
390
392
  A(h, { ...S, phase: "start" });
@@ -395,10 +397,10 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
395
397
  const C = await T.loadPage(t, { signal: p.signal });
396
398
  if (p.signal.aborted) return;
397
399
  const c = ee(C, t.pageSize);
398
- L = !0, g({ ...c, token: b, status: "success" }), A(h, { ...S, phase: "success", rowCount: c.rows.length });
400
+ L = !0, f({ ...c, token: b, status: "success" }), A(h, { ...S, phase: "success", rowCount: c.rows.length });
399
401
  } catch {
400
402
  if (p.signal.aborted) return;
401
- L = !0, g({ token: b, status: "error", rows: Re, total: 0 }), A(h, { ...S, phase: "error" });
403
+ L = !0, f({ token: b, status: "error", rows: Re, total: 0 }), A(h, { ...S, phase: "error" });
402
404
  }
403
405
  })(), () => {
404
406
  p.abort(), L || A(h, { ...S, phase: "cancel" });
@@ -411,36 +413,36 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
411
413
  status: x?.status ?? "loading",
412
414
  reload: () => I((p) => p + 1)
413
415
  };
414
- }, Z = { keyword: "", applicantId: "", processStatus: "", startDate: "", endDate: "" }, me = ["pending", "approved"], fe = { pending: "待处理", approved: "已完成", initiated: "已发起" }, q = (e) => {
416
+ }, Z = { keyword: "", applicantId: "", processStatus: "", startDate: "", endDate: "" }, me = ["pending", "approved"], ge = { pending: "待处理", approved: "已完成", initiated: "已发起" }, q = (e) => {
415
417
  if (e === "") return !0;
416
418
  if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
417
419
  const t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
418
420
  return Number.isFinite(t.getTime()) && t.toISOString().slice(0, 10) === e;
419
- }, Pe = ({ components: e, provider: t, onOpenApproval: l, applicantOptions: P = [], pageSize: H = 20, refreshKey: I, themeKey: E, logger: g, className: y, presentation: b = "desktop", tabs: x = me }) => {
420
- const { Input: p, Select: T, DateRangePicker: h, Button: S, Tabs: L } = e, C = we(), [c, R] = D(Z), [V, o] = D(0), [u, d] = D(""), [m, M] = D(""), [B, $] = D({ ...Z, tab: x[0], page: 1, pageSize: H }), { initialPage: r, status: a, reload: f } = Ie(t, B, I, g), w = O(!1), F = O(!0);
421
- J(() => (F.current = !0, () => {
422
- F.current = !1;
421
+ }, Pe = ({ components: e, provider: t, onOpenApproval: l, applicantOptions: P = [], pageSize: $ = 20, refreshKey: I, themeKey: E, logger: f, className: y, presentation: b = "desktop", tabs: x = me }) => {
422
+ const { Input: p, Select: T, DateRangePicker: h, Button: S, Tabs: L } = e, C = we(), [c, R] = D(Z), [V, o] = D(0), [u, d] = D(""), [m, M] = D(""), [B, H] = D({ ...Z, tab: x[0], page: 1, pageSize: $ }), { initialPage: r, status: a, reload: g } = Ie(t, B, I, f), w = O(!1), W = O(!0);
423
+ J(() => (W.current = !0, () => {
424
+ W.current = !1;
423
425
  }), []);
424
- const v = a === "loading", W = async (i) => {
426
+ const v = a === "loading", F = async (i) => {
425
427
  if (!w.current) {
426
- w.current = !0, M(""), A(g, { operation: "open", phase: "start" });
428
+ w.current = !0, M(""), A(f, { operation: "open", phase: "start" });
427
429
  try {
428
- await l(i), A(g, { operation: "open", phase: "success" });
430
+ await l(i), A(f, { operation: "open", phase: "success" });
429
431
  } catch {
430
- F.current && M("审批详情打开失败,请重试"), A(g, { operation: "open", phase: "error" });
432
+ W.current && M("审批详情打开失败,请重试"), A(f, { operation: "open", phase: "error" });
431
433
  } finally {
432
434
  w.current = !1;
433
435
  }
434
436
  }
435
437
  }, X = (i) => {
436
- i === B.tab || !x.includes(i) || (d(""), M(""), i === "initiated" && R((s) => ({ ...s, keyword: "", applicantId: "", processStatus: "" })), $((s) => ({ ...s, ...i === "initiated" ? { keyword: "", applicantId: "", processStatus: "" } : {}, tab: i, page: 1 })));
438
+ i === B.tab || !x.includes(i) || (d(""), M(""), i === "initiated" && R((s) => ({ ...s, keyword: "", applicantId: "", processStatus: "" })), H((s) => ({ ...s, ...i === "initiated" ? { keyword: "", applicantId: "", processStatus: "" } : {}, tab: i, page: 1 })));
437
439
  }, Y = (i) => {
438
- R((s) => ({ ...s, ...i })), b === "mobile" && (d(""), M(""), $((s) => ({ ...s, ...i, page: 1 })));
440
+ R((s) => ({ ...s, ...i })), b === "mobile" && (d(""), M(""), H((s) => ({ ...s, ...i, page: 1 })));
439
441
  };
440
- return /* @__PURE__ */ n("section", { className: ["make-app-approval", b === "mobile" && "make-app-approval--mobile", y].filter(Boolean).join(" "), "aria-label": "我的审批", children: /* @__PURE__ */ N(L, { items: x.map((i) => ({ value: i, label: fe[i] })), value: B.tab, onChange: X, ariaLabel: "审批分类", children: [
442
+ return /* @__PURE__ */ n("section", { className: ["make-app-approval", b === "mobile" && "make-app-approval--mobile", y].filter(Boolean).join(" "), "aria-label": "我的审批", children: /* @__PURE__ */ N(L, { items: x.map((i) => ({ value: i, label: ge[i] })), value: B.tab, onChange: X, ariaLabel: "审批分类", children: [
441
443
  /* @__PURE__ */ N("form", { className: "make-app-approval-filters", onSubmit: (i) => {
442
444
  if (i.preventDefault(), b === "mobile") {
443
- d(""), M(""), $((s) => ({ ...s, keyword: c.keyword.trim(), page: 1 }));
445
+ d(""), M(""), H((s) => ({ ...s, keyword: c.keyword.trim(), page: 1 }));
444
446
  return;
445
447
  }
446
448
  if (!q(c.startDate) || !q(c.endDate)) {
@@ -451,7 +453,7 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
451
453
  d("开始日期不能晚于结束日期");
452
454
  return;
453
455
  }
454
- d(""), M(""), $((s) => ({ ...s, ...c, keyword: c.keyword.trim(), page: 1 }));
456
+ d(""), M(""), H((s) => ({ ...s, ...c, keyword: c.keyword.trim(), page: 1 }));
455
457
  }, children: [
456
458
  B.tab !== "initiated" && /* @__PURE__ */ N("div", { className: "make-app-approval-filter-field", children: [
457
459
  b === "mobile" && /* @__PURE__ */ n(S, { htmlType: "submit", variant: "text", ariaLabel: "搜索申请单ID", children: /* @__PURE__ */ N("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
@@ -459,7 +461,7 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
459
461
  /* @__PURE__ */ n("path", { d: "m16 16 5 5" })
460
462
  ] }) }),
461
463
  /* @__PURE__ */ n(p, { id: `${C}-keyword`, ariaLabel: "申请单ID", placeholder: "搜索申请单ID", value: c.keyword, onChange: (i) => {
462
- R((s) => ({ ...s, keyword: i })), b === "mobile" && !i && $((s) => ({ ...s, keyword: "", page: 1 }));
464
+ R((s) => ({ ...s, keyword: i })), b === "mobile" && !i && H((s) => ({ ...s, keyword: "", page: 1 }));
463
465
  } })
464
466
  ] }),
465
467
  /* @__PURE__ */ n("div", { className: "make-app-approval-date-control", children: /* @__PURE__ */ n(
@@ -497,29 +499,29 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
497
499
  b !== "mobile" && /* @__PURE__ */ N("div", { className: "make-app-approval-filter-actions", children: [
498
500
  /* @__PURE__ */ n(S, { htmlType: "submit", variant: "primary", children: "查询" }),
499
501
  /* @__PURE__ */ n(S, { htmlType: "button", variant: "default", onClick: () => {
500
- R(Z), o((i) => i + 1), d(""), M(""), $((i) => ({ ...i, ...Z, page: 1 }));
502
+ R(Z), o((i) => i + 1), d(""), M(""), H((i) => ({ ...i, ...Z, page: 1 }));
501
503
  }, children: "重置" }),
502
- /* @__PURE__ */ n(S, { htmlType: "button", variant: "default", disabled: v, loading: v, onClick: f, children: "刷新" })
504
+ /* @__PURE__ */ n(S, { htmlType: "button", variant: "default", disabled: v, loading: v, onClick: g, children: "刷新" })
503
505
  ] })
504
506
  ] }),
505
507
  u && /* @__PURE__ */ n("p", { role: "alert", className: "make-app-approval-error", children: u }),
506
508
  m && /* @__PURE__ */ n("p", { role: "alert", className: "make-app-approval-error", children: m }),
507
509
  /* @__PURE__ */ N("div", { className: "make-app-approval-results", "aria-busy": v, children: [
508
- b === "mobile" ? r && /* @__PURE__ */ n(Se, { initialPage: r, query: B, provider: t, onReload: f, components: e, onOpen: (i) => {
509
- W(i);
510
- }, logger: g }, JSON.stringify([B, I, r])) : /* @__PURE__ */ n(Ce, { components: e, initialPage: r, query: B, provider: t, onOpen: (i) => {
511
- W(i);
512
- }, onReload: f, themeKey: E, logger: g }),
510
+ b === "mobile" ? r && /* @__PURE__ */ n(Se, { initialPage: r, query: B, provider: t, onReload: g, components: e, onOpen: (i) => {
511
+ F(i);
512
+ }, logger: f }, JSON.stringify([B, I, r])) : /* @__PURE__ */ n(Ce, { components: e, initialPage: r, query: B, provider: t, onOpen: (i) => {
513
+ F(i);
514
+ }, onReload: g, themeKey: E, logger: f }),
513
515
  v && /* @__PURE__ */ n("div", { className: "make-app-approval-overlay", role: "status", children: "正在加载审批记录…" }),
514
516
  a === "error" && /* @__PURE__ */ N("div", { className: "make-app-approval-overlay", role: "alert", children: [
515
517
  /* @__PURE__ */ n("span", { children: "审批列表加载失败,请重试" }),
516
- /* @__PURE__ */ n(S, { htmlType: "button", variant: "default", onClick: f, children: "重试" })
518
+ /* @__PURE__ */ n(S, { htmlType: "button", variant: "default", onClick: g, children: "重试" })
517
519
  ] })
518
520
  ] })
519
521
  ] }) });
520
522
  }, Ee = (e) => {
521
523
  const t = e.pageSize ?? 20, l = e.tabs ?? me;
522
- if (!l.length || new Set(l).size !== l.length || l.some((P) => !Object.hasOwn(fe, P))) throw new Error("MyApprovalsPage requires valid unique tabs");
524
+ if (!l.length || new Set(l).size !== l.length || l.some((P) => !Object.hasOwn(ge, P))) throw new Error("MyApprovalsPage requires valid unique tabs");
523
525
  if (!e.scopeKey.trim()) throw new Error("MyApprovalsPage requires scopeKey");
524
526
  for (const P of ["Input", "Select", "DateRangePicker", "Button", "Tabs"])
525
527
  if (!e.components?.[P]) throw new Error(`MyApprovalsPage requires components.${P}`);
@@ -220,6 +220,17 @@ const provider: ApprovalListProvider = {
220
220
 
221
221
  代码示例见 `examples/detail-integration.tsx` 与 `examples/antd-components.tsx`。`loadDetail` 统一返回包的字段描述和授权结构;公开结构并不是直接照搬后端 DTO,尤其 fields 需要宿主补齐。
222
222
 
223
+ ### URL 字段的只读展示
224
+
225
+ 任务只读字段和实例详情复用宿主已有 URL 展示器,桌面与手机采用同一值合同。审批包只传递已授权字段的 Schema、值及 `readOnly` 等状态,不内置第二套 URL 渲染或导航引擎。
226
+
227
+ - 宿主先核对字段合同,归一化 URL 字符串或受支持的 `href/url/value` 目标与 `label/name` 显示文字。仅对 URL 字段生成外链;普通文本、附件及 Lookup 标签沿用各自展示逻辑。
228
+ - `href` 必须经过宿主明确的协议白名单和控制字符校验;拒绝脚本、数据等危险目标。无效值显示普通文本,空值显示 `-`,不生成可点击的占位地址。合法目标保留原始路径、查询参数与显示文字,不拼接到当前页面地址。
229
+ - 使用宿主组件库的 Link 或带明确链接类名/样式的语义 `a[href]`,默认信息蓝,长地址允许在可用宽度内换行,并提供悬浮下划线与键盘焦点。宿主 CSS reset 可能让裸 `a` 继承正文色;不能依赖浏览器默认外观。新窗口链接保留 `target="_blank"` 和 `rel="noopener noreferrer"`,点击隔离卡片/记录操作,同时保留原生导航及键盘行为。
230
+ - 手机继续复用 `MobileFieldRow` 及宿主 Link。移动包源码新增字段值区域内真实 `a[href]` 的链接样式兜底,使用独立 `--make-mobile-link-color`(默认 `#1677ff`),但正式 `0.1.14` 尚不包含该修复。以实际安装包的能力、CSS 和发布状态为准,不能因组件已存在就移除宿主链接样式。
231
+
232
+ 回归覆盖任务/实例、桌面/手机、仅可读字段、空值、对象形式 URL、非法协议、长地址、键盘打开及卡片点击隔离。DOM 中有 `a` 不等于视觉通过;在宿主真实 CSS reset 和主题下检查实际链接颜色、窄屏换行与焦点。
233
+
223
234
  ### 当前任务字段的来源
224
235
 
225
236
  宿主 Service 读取一次 `POST /make/workflow/v1/bpm-task`、target `MakeService.GetResource`,校验任务定位与当前应用,从同次 `data.formMetadata` 取得字段定义。请求只有任务定位:
@@ -3,7 +3,7 @@
3
3
  本包采用 `@qfei/component-release-tools@^0.5.2` 的单包发布流程,以
4
4
  `make-app-observability` 的 `e9ed50a00aa2fd467dafbbc4c84577689c400816`
5
5
  版本为对齐基准。`.gitlab-ci.yml` 与该基准逐字节一致,
6
- `package.json.qfeiRelease` 配置一致。按当前需求,`.npmrc` 在标准安装认证配置上增加
6
+ `package.json.qfeiRelease` 沿用同一发布流程,并将 npmjs 发布后版本校验的累计重试等待上限设为 10 分钟。按当前需求,`.npmrc` 在标准安装认证配置上增加
7
7
  `@qfei-design` 的 npmjs 安装源,使 CanvasTable 从公网安装。发布统一在 GitLab 任务中执行。
8
8
 
9
9
  ## 安装源与发布目标
@@ -109,6 +109,36 @@ npm pack --dry-run --ignore-scripts
109
109
  完整性:与本次产物一致则跳过该目标,不一致则失败,不能用同版本覆盖不同内容。
110
110
  不要通过修改目标列表绕过失败目标;需要改动产物时使用新版本。
111
111
 
112
+ ### npmjs 接受上传后,版本暂时不可见
113
+
114
+ npmjs 返回发布成功并提示包仍在处理中时,版本和 `latest` 可能尚未在查询接口可见。
115
+ 公共工具默认累计重试等待 180 秒;本包通过以下配置增加到 600000 毫秒(10 分钟),
116
+ 沿用工具已有的递增间隔重试及版本一致性校验。查询到目标版本后立即通过;
117
+ 超过上限仍不一致则继续报错,内部仓库保持工具默认的 42000 毫秒等待上限。
118
+ 该上限统计重试等待时间,查询本身耗时另计,因此任务总时长可能更长。
119
+
120
+ ```json
121
+ {
122
+ "qfeiRelease": {
123
+ "distTagVerificationTimeoutMs": {
124
+ "npmjs": 600000
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ 若任务已经因校验超时失败,先核对两个仓库的目标版本、`latest` 和产物校验值,
131
+ 确认状态后重试原标签的 `publish_latest` 任务。已有同版本且内容一致时,工具跳过上传并重新校验;
132
+ 内容不一致时仍拒绝覆盖。通知步骤读取任务状态,失败通知本身不表示 npm 包上传失败。
133
+
134
+ 2026-11-12 的 `v0.2.13` 任务中,npmjs 在北京时间 17:52:17 接受上传,
135
+ 工具于 17:55:32 校验超时报错;npmjs 元数据记录的发布时间为 17:56:28。
136
+ 排查时已确认 npmjs 的 `latest` 指向 `0.2.13`,且产物校验值与任务日志一致,
137
+ 可重试原任务完成验证,无需另升版本或修改既有发布标签。
138
+
139
+ 等待上限配置仅对包含该改动的提交和后续发布标签生效;重试旧标签仍使用旧配置。
140
+ 不要为应用此配置移动已发布标签或改变既有版本的产物。
141
+
112
142
  本地检查通过不代表远端 Runner、保护策略或发布账号权限已配置完成。本地 `origin`
113
143
  已配置为 `https://git.qtech.cn/front-end/make/make-app-approval.git`,首次发布前仍需落实
114
144
  上述外部配置。
@@ -70,6 +70,9 @@ submitAction(input, { signal })
70
70
 
71
71
  renderField({ field, value, readOnly, disabled, error, onChange })
72
72
  -> 根据 field.schema 复用宿主控件;桌面非附件可编辑字段用无边框模式及 make-app-approval-inline-editor 容器,悬浮/焦点显示底色。手机切换到 examples/field-adapters 的独立适配,不套该容器,沿用内容区背景、不单独添加字段背景色,并保留键盘焦点提示。附件保留原样,只读用详情展示。
73
+ -> URL 只读字段复用宿主统一 URL 展示器和带链接样式的 Link,保持语义 a[href]、信息蓝、长地址换行及键盘焦点;不能依赖被 reset 清除的浏览器默认链接颜色。手机旧包也须保留宿主 Link 外观,不凭源码认定安装产物已包含新样式。
74
+ -> URL 的字符串或 href/url/value、label/name 形状由宿主已验证的字段合同归一化;目标经过明确协议白名单与控制字符校验,危险或无效值显示普通文本,空值显示 -。禁止把普通 Text、附件或 Lookup 标签一律自动识别为外链。
75
+ -> 保留合法原始查询参数和显示文字;新窗口链接使用 target="_blank"、rel="noopener noreferrer",点击仅 stopPropagation 隔离记录/卡片操作,不 preventDefault 阻止正常导航。包不接管 URL 解析或导航。
73
76
  -> 复杂字段、附件、关联候选的权限与值序列化仍由宿主负责。
74
77
  -> 禁止自行从缓存补出包未传入的隐藏字段。
75
78
  validateFields({ fields, values, actionType, signal })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qfei-design/make-app-approval",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Make App 审批公共组件与普通记录编辑限制。",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -83,6 +83,9 @@
83
83
  "prereleasePublishTargets": [
84
84
  "internal"
85
85
  ],
86
+ "distTagVerificationTimeoutMs": {
87
+ "npmjs": 600000
88
+ },
86
89
  "npmjs": {
87
90
  "registry": "https://registry.npmjs.org/",
88
91
  "access": "public",