@qfei-design/make-app-approval 0.2.5 → 0.2.6
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/README.md +2 -2
- package/dist/list.cjs +1 -1
- package/dist/list.mjs +223 -219
- package/docs/publishing.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Make App 审批公共 npm 包,统一审批相关 UI、交互和样式。源码由本独立项目维护;ExpensePoc 是首个接入应用。
|
|
4
4
|
|
|
5
|
-
**本次版本为 0.2.
|
|
5
|
+
**本次版本为 0.2.6。** 日期范围控件合同从 0.2.0 起相较 0.1.0 有不兼容调整,升级前请阅读 [迁移说明](PUBLIC_API.md#020-日期范围组件迁移)。 已有基于 CanvasTable 的桌面审批列表、流程状态组件和普通记录编辑限制。已提供按节点授权的办理详情与动作组件;真实接口联调、流程表和移动审批页面尚未完成。接入先读 [包与宿主职责及接入步骤](docs/host-integration.md),再读 [公开 API](PUBLIC_API.md)。
|
|
6
6
|
|
|
7
7
|
## 当前提供
|
|
8
8
|
|
|
@@ -67,4 +67,4 @@ const status = <ApprovalStatus value={record[APPROVAL_STATUS_FIELD]} />;
|
|
|
67
67
|
|
|
68
68
|
采用与 `make-app-observability` 一致的 `@qfei/component-release-tools` 和 GitLab CI 流程。alpha/beta 由 dev/test 手动流水线触发,只发布内部 Nexus;latest 由受保护的 `vX.Y.Z` 标签手动任务触发,将同一份产物发布到内部 Nexus 和 npmjs。分支验证同时覆盖 React 19 和 React 18。
|
|
69
69
|
|
|
70
|
-
完整的分支流程、初始化命令、CI 变量和失败重试说明见 [发布规范](docs/publishing.md)。远端仓库为 [make-app-approval](https://git.qtech.cn/front-end/make/make-app-approval),本地通过 `origin` 关联。本次 0.2.
|
|
70
|
+
完整的分支流程、初始化命令、CI 变量和失败重试说明见 [发布规范](docs/publishing.md)。远端仓库为 [make-app-approval](https://git.qtech.cn/front-end/make/make-app-approval),本地通过 `origin` 关联。本次 0.2.6 的发布状态以 GitLab 任务和 registry 查询为准。本地只运行验证和打包,不运行发布命令。不要仅凭本地版本号认定 registry 已有对应版本。
|
package/dist/list.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var se=Object.create;var Z=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var pe=(e,t,l,z)=>{if(t&&typeof t=="object"||typeof t=="function")for(let T of ie(t))!ce.call(e,T)&&T!==l&&Z(e,T,{get:()=>t[T],enumerable:!(z=ne(t,T))||z.enumerable});return e};var de=(e,t,l)=>(l=e!=null?se(le(e)):{},pe(t||!e||!e.__esModule?Z(l,"default",{value:e,enumerable:!0}):l,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),ue=require("./index.cjs"),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")}},fe=e=>e==null||e==="UNSUBMITTED"?"状态未知":ue.getApprovalStatusDisplay(e).label,te=e=>typeof e=="object"&&e!==null,ge=e=>te(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)&&(typeof e.processStatus=="string"||e.processStatus===null):!1,Y=(e,t)=>{if(!te(e)||!Array.isArray(e.rows)||!e.rows.every(ge)||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(l=>l.id)).size!==e.rows.length)throw new Error("Invalid approval page contract");return{rows:e.rows,total:e.total}},he=({table:e,query:t,initialPage:l,loadPage:z,onChange:T,retryViewport:L,onReload:V,logger:C})=>{const f=new Map,I=new Set;let N=[];const p=new WeakMap,g=new Set;let v=l,b=l.total,d=0,k=!1,x=!1,j;const M=r=>Number.isSafeInteger(r)&&r>=0&&r*t.pageSize<b,m=(r,a,u)=>A(C,{operation:"list",phase:a,tab:t.tab,page:r+1,pageSize:t.pageSize,rowCount:u}),h=()=>{k||T({total:b,rows:N,failed:x||g.size>0,loading:f.size>0})},R=r=>{r.finished||(r.finished=!0,r.removeAbort(),f.get(r.page)===r&&f.delete(r.page),e.markPageLoadFailed(r.page,r.request),r.controller.abort(),m(r.page,"cancel"))},c=r=>{d=r;const a=e.getPagesInView()??[],u=new Set([d,...a].flatMap(n=>[n-1,n,n+1]).filter(M));for(const n of f.values())u.has(n.page)||R(n);for(const n of g)u.has(n)||g.delete(n)},D=(r,a,u)=>{const n=a.rows.map(w=>{const s={...w,statusLabel:fe(w.processStatus)};return p.set(s,w),s});if(!e.setVirtualPageData(n,r,a.total,u)){m(r,"skip");return}b=a.total;try{N=Y({rows:e.getTableData()??[],total:b},Number.MAX_SAFE_INTEGER).rows.map(w=>p.get(w)??w)}catch(w){x=!0,N=[],v=void 0,j&&clearTimeout(j),j=void 0;for(const s of f.values())R(s);throw w}v&&v.total!==b&&(v=void 0),g.delete(r);for(const w of f.values())M(w.page)||R(w);!M(r)&&r>0&&e.scrollToRow(Math.max(0,b-1)),m(r,"success",a.rows.length)},F=()=>{if(k||j)return;const r=[...f.values()].filter(a=>!a.running&&!a.finished).sort((a,u)=>Math.abs(a.page-d)-Math.abs(u.page-d)||a.page-u.page);for(const a of r){if(I.size>=2)break;a.running=!0,I.add(a),m(a.page,"start"),(async()=>{try{const u=await z({...t,page:a.page+1},{signal:a.controller.signal});if(k||a.finished||a.controller.signal.aborted)return;const n=Y(u,t.pageSize);a.finished=!0,a.removeAbort(),f.delete(a.page),D(a.page,n,a.request)}catch{!k&&!a.controller.signal.aborted&&(g.add(a.page),m(a.page,"error"),e.markPageLoadFailed(a.page,a.request))}finally{a.finished||(a.finished=!0,a.removeAbort(),f.get(a.page)===a&&f.delete(a.page)),I.delete(a),h(),F()}})()}h()},O=()=>{j&&clearTimeout(j),j=setTimeout(()=>{j=void 0,F()},120)};return{load(r,a){if(a.useRequestIdentity(),k||x||a.signal.aborted||!M(r)){e.markPageLoadFailed(r,a),m(r,"skip");return}const u=f.get(r);if(u?.request===a&&!u.finished)return;if(u&&R(u),c(r),r===0&&v){const w=v;v=void 0;try{D(0,w,a)}catch{g.add(r),e.markPageLoadFailed(r,a),m(r,"error")}h();return}const n={page:r,request:a,controller:new AbortController,running:!1,finished:!1,removeAbort:()=>{}},B=()=>{R(n),h()};a.signal.addEventListener("abort",B,{once:!0}),n.removeAbort=()=>a.signal.removeEventListener("abort",B),f.set(r,n),O(),h()},viewportChanged(){if(k)return;const r=e.getPagesInView();r?.length&&(c(r[0]),f.size&&O(),h())},retry(){if(!k){if(x){V();return}g.size!==0&&(g.clear(),L(),h())}},dispose(){k=!0,j&&clearTimeout(j),j=void 0;for(const r of f.values())R(r);N=[],g.clear(),v=void 0}}},me=[{key:"applicationNo",title:"申请单ID",width:260},{key:"applicationType",title:"业务表单",width:180},{key:"applicantName",title:"申请人",width:170},{key:"applicationTime",title:"申请时间",width:220}].map(e=>({...e,showEllipsis:!0,sortable:!1})),q=40,ve=e=>{const t=i.useRef(void 0);return e.initialPage?o.jsx(be,{...e,initialPage:e.initialPage,restoreScroll:t.current?.query===e.query?t.current.position:void 0,rememberScroll:l=>{t.current={query:e.query,position:l}}}):o.jsx("div",{className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"})},be=({components:{Button:e},initialPage:t,query:l,provider:z,themeKey:T,onOpen:L,onReload:V,logger:C,restoreScroll:f,rememberScroll:I})=>{const N=i.useRef(null),p=i.useRef(null),g=i.useRef(null),[v,b]=i.useState(!1),[d,k]=i.useState(0),[x,j]=i.useState({...t,failed:!1,loading:!1}),M=i.useRef(t.rows),m=i.useRef(f),h=i.useRef({provider:z,onOpen:L,onReload:V,logger:C,rememberScroll:I});h.current={provider:z,onOpen:L,onReload:V,logger:C,rememberScroll:I};const R=i.useRef(()=>{});return i.useEffect(()=>{const c=N.current;if(!c)return;let D=!1,F,O,r,a=t.total;A(h.current.logger,{operation:"table",phase:"start"});const u=()=>{D||(b(!0),A(h.current.logger,{operation:"table",phase:"error"}))};return import("@qfei-design/canvas-table").then(n=>{if(D)return;const B=()=>{const s=p.current,S=s?.getScrollState();s&&S&&n.globalEventBus.emitWithNamespace("scroll:change",s.tableId,S)},w=()=>{if(!D)try{const{width:s,height:S}=c.getBoundingClientRect();if(s<=0||S<=0)return;const E=getComputedStyle(c),G={rowHeight:q,headerHeight:40,fontSize:14,fontFamily:E.fontFamily||"Arial, sans-serif",...E.color?{textColor:E.color}:{},...E.getPropertyValue("--make-approval-bg").trim()?{rowBgColor:E.getPropertyValue("--make-approval-bg").trim()}:{},...E.getPropertyValue("--make-approval-header").trim()?{headerBgColor:E.getPropertyValue("--make-approval-header").trim()}:{},...E.getPropertyValue("--make-approval-border").trim()?{borderColor:E.getPropertyValue("--make-approval-border").trim()}:{}},ae=Math.max(Math.ceil(300/l.pageSize),Math.ceil(S*3/q/l.pageSize)+2)*l.pageSize,J={enabled:!0,totalRowCount:a,pageSize:l.pageSize,maxCachedRows:ae};if(p.current){p.current.updateProps({canvasWidth:s,canvasHeight:S,style:G,virtualOptions:J}),p.current.updateCanvasSize(s,S,!0),B();return}p.current=new n.CanvasTableComponent(c,{columns:me,canvasWidth:s,canvasHeight:S,style:G,rowKey:"id",showSN:{enabled:!0,width:64,formatter:(y,P)=>P+1},virtualOptions:J,selectable:{enabled:!1},rowSortable:{enabled:!1},editApplyMode:"controlled",customEdit:y=>{y.cancel()},emptyStateOptions:{text:"暂无审批记录"},bodyRowHeadSuffixOptions:{enabled:!0,width:20,render:({group:y,x:P,height:_,rowData:U})=>{const re=U?.id,W=new n.RectShape({name:"approval-open",x:P,y:_/2-10,cursor:"pointer",tooltip:"查看审批详情",attrs:{width:20,height:20,fill:"transparent",stroke:"transparent"}});W.addChild(new n.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="${E.color||"#64748b"}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)}})),W.on("mousedown",X=>X.stopPropagation?.()),W.on("click",X=>{X.stopPropagation?.();const Q=M.current.find(oe=>oe.id===re);Q&&h.current.onOpen(Q)}),y.addChild(W)}}});const K=p.current,H=he({table:K,query:l,initialPage:t,retryViewport:B,onReload:()=>h.current.onReload(),loadPage:(y,P)=>h.current.provider.loadPage(y,P),logger:y=>A(h.current.logger,y),onChange:y=>{D||(a=y.total,M.current=y.rows,j(P=>P.total===y.total&&P.failed===y.failed&&P.loading===y.loading&&P.rows.length===y.rows.length&&P.rows.every((_,U)=>_===y.rows[U])?P:y))}});g.current=H,O=n.globalEventBus.onWithNamespace("data:load",K.tableId,(y,P)=>H.load(y,P)),r=n.globalEventBus.onWithNamespace("scroll:change",K.tableId,()=>H.viewportChanged()),m.current&&K.scrollTo(m.current.scrollX,m.current.scrollY),b(!1),A(h.current.logger,{operation:"table",phase:"success"})}catch{u()}};R.current=w,F=new ResizeObserver(w),F.observe(c),w()}).catch(u),()=>{D=!0,F?.disconnect(),R.current=()=>{},p.current&&(m.current=p.current.getScrollState(),m.current&&h.current.rememberScroll(m.current)),O?.(),r?.(),g.current?.dispose(),g.current=null,p.current?.destroy(),p.current=null,A(h.current.logger,{operation:"table",phase:"destroy"})}},[t,l,d]),i.useEffect(()=>{R.current()},[T]),o.jsxs("div",{className:"make-app-approval-table-frame","aria-busy":x.loading,children:[o.jsx("div",{ref:N,className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"}),v&&o.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:["表格加载失败 ",o.jsx(e,{htmlType:"button",variant:"default",onClick:()=>{b(!1),k(c=>c+1)},children:"重新加载表格"})]}),!v&&x.failed&&o.jsxs("div",{className:"make-app-approval-table-feedback",role:"alert",children:["部分审批记录加载失败 ",o.jsx(e,{htmlType:"button",variant:"default",onClick:()=>g.current?.retry(),children:"重试加载"})]}),!v&&!x.failed&&x.loading&&o.jsxs("div",{className:"make-app-approval-table-loading",role:"status","aria-label":"正在加载审批记录","aria-live":"polite",children:[o.jsx("span",{className:"make-app-approval-loading-spinner","aria-hidden":"true"}),o.jsx("span",{children:"加载中"})]}),o.jsxs("ul",{className:"make-app-approval-accessible-rows","aria-label":"审批记录文字视图",children:[x.total===0&&o.jsx("li",{children:"暂无审批记录"}),x.rows.map(c=>o.jsxs("li",{children:[o.jsxs("span",{children:[c.applicationNo,",",c.applicationType,",",c.applicantName,",",c.applicationTime,"。"]}),o.jsxs(e,{htmlType:"button",variant:"text",onClick:()=>L(c),children:["打开 ",c.applicationNo||c.applicationType," 的审批详情"]})]},c.id))]})]})},we=[],ye=(e,t,l,z)=>{const[T,L]=i.useState(0),[V,C]=i.useState(),f=i.useRef({provider:e,logger:z});f.current={provider:e,logger:z};const I=i.useMemo(()=>({}),[t,l,T]);i.useEffect(()=>{const p=new AbortController,{provider:g,logger:v}=f.current,b={operation:"list",tab:t.tab,page:t.page,pageSize:t.pageSize};A(v,{...b,phase:"start"});let d=!1;return(async()=>{try{if(await Promise.resolve(),p.signal.aborted)return;const k=await g.loadPage(t,{signal:p.signal});if(p.signal.aborted)return;const x=Y(k,t.pageSize);d=!0,C({...x,token:I,status:"success"}),A(v,{...b,phase:"success",rowCount:x.rows.length})}catch{if(p.signal.aborted)return;d=!0,C({token:I,status:"error",rows:we,total:0}),A(v,{...b,phase:"error"})}})(),()=>{p.abort(),d||A(v,{...b,phase:"cancel"})}},[t,I]);const N=V?.token===I?V:void 0;return{initialPage:N?.status==="success"?N:void 0,total:N?.total??0,status:N?.status??"loading",reload:()=>L(p=>p+1)}},$={keyword:"",applicantId:"",processStatus:"",startDate:"",endDate:""},Se=[{value:"pending",label:"待处理"},{value:"approved",label:"已完成"}],ee=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},ke=({components:e,provider:t,onOpenApproval:l,applicantOptions:z=[],pageSize:T=20,refreshKey:L,themeKey:V,logger:C,className:f})=>{const{Input:I,Select:N,DateRangePicker:p,Button:g,Tabs:v}=e,b=i.useId(),[d,k]=i.useState($),[x,j]=i.useState(0),[M,m]=i.useState(""),[h,R]=i.useState(""),[c,D]=i.useState({...$,tab:"pending",page:1,pageSize:T}),{initialPage:F,status:O,reload:r}=ye(t,c,L,C),a=i.useRef(!1),u=i.useRef(!0);i.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const n=O==="loading",B=async s=>{if(!a.current){a.current=!0,R(""),A(C,{operation:"open",phase:"start"});try{await l(s),A(C,{operation:"open",phase:"success"})}catch{u.current&&R("审批详情打开失败,请重试"),A(C,{operation:"open",phase:"error"})}finally{a.current=!1}}},w=s=>{s!==c.tab&&(m(""),R(""),D(S=>({...S,tab:s,page:1})))};return o.jsx("section",{className:["make-app-approval",f].filter(Boolean).join(" "),"aria-label":"我的审批",children:o.jsxs(v,{items:Se,value:c.tab,onChange:w,ariaLabel:"审批分类",children:[o.jsxs("form",{className:"make-app-approval-filters",onSubmit:s=>{if(s.preventDefault(),!ee(d.startDate)||!ee(d.endDate)){m("请选择有效日期");return}if(d.startDate&&d.endDate&&d.startDate>d.endDate){m("开始日期不能晚于结束日期");return}m(""),R(""),D(S=>({...S,...d,keyword:d.keyword.trim(),page:1}))},children:[o.jsx("div",{className:"make-app-approval-filter-field",children:o.jsx(I,{id:`${b}-keyword`,ariaLabel:"申请单ID",placeholder:"搜索申请单ID",value:d.keyword,onChange:s=>k(S=>({...S,keyword:s}))})}),o.jsx("div",{className:"make-app-approval-date-control",children:o.jsx(p,{id:`${b}-period`,ariaLabel:"申请时间",placeholder:["开始日期","结束日期"],value:[d.startDate,d.endDate],onChange:([s,S])=>k(E=>({...E,startDate:s,endDate:S}))},x)}),o.jsx("div",{className:"make-app-approval-filter-field",children:o.jsx(N,{id:`${b}-applicant`,ariaLabel:"申请人",purpose:"applicant",value:d.applicantId??"",options:[{value:"",label:"全部申请人"},...z.filter(s=>s.value!=="")],onChange:s=>k(S=>({...S,applicantId:s}))})}),o.jsxs("div",{className:"make-app-approval-filter-actions",children:[o.jsx(g,{htmlType:"submit",variant:"primary",children:"查询"}),o.jsx(g,{htmlType:"button",variant:"default",onClick:()=>{k($),j(s=>s+1),m(""),R(""),D(s=>({...s,...$,page:1}))},children:"重置"}),o.jsx(g,{htmlType:"button",variant:"default",disabled:n,loading:n,onClick:r,children:"刷新"})]})]}),M&&o.jsx("p",{role:"alert",className:"make-app-approval-error",children:M}),h&&o.jsx("p",{role:"alert",className:"make-app-approval-error",children:h}),o.jsxs("div",{className:"make-app-approval-results","aria-busy":n,children:[o.jsx(ve,{components:e,initialPage:F,query:c,provider:t,onOpen:s=>{B(s)},onReload:r,themeKey:V,logger:C}),n&&o.jsx("div",{className:"make-app-approval-overlay",role:"status",children:"正在加载审批记录…"}),O==="error"&&o.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:[o.jsx("span",{children:"审批列表加载失败,请重试"}),o.jsx(g,{htmlType:"button",variant:"default",onClick:r,children:"重试"})]})]})]})})},xe=e=>{const t=e.pageSize??20;if(!e.scopeKey.trim())throw new Error("MyApprovalsPage requires scopeKey");for(const l of["Input","Select","DateRangePicker","Button","Tabs"])if(!e.components?.[l])throw new Error(`MyApprovalsPage requires components.${l}`);if(!Number.isSafeInteger(t)||t<1||t>200)throw new Error("pageSize must be an integer from 1 to 200");return o.jsx(ke,{...e,pageSize:t},JSON.stringify([e.scopeKey,t]))};exports.MyApprovalsPage=xe;
|
|
1
|
+
"use strict";var ce=Object.create;var ae=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var ge=(e,t,i,A)=>{if(t&&typeof t=="object"||typeof t=="function")for(let P of de(t))!fe.call(e,P)&&P!==i&&ae(e,P,{get:()=>t[P],enumerable:!(A=pe(t,P))||A.enumerable});return e};var he=(e,t,i)=>(i=e!=null?ce(ue(e)):{},ge(t||!e||!e.__esModule?ae(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("react"),me=require("./index.cjs"),I=(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")}},ve=e=>e==null||e==="UNSUBMITTED"?"状态未知":me.getApprovalStatusDisplay(e).label,se=e=>typeof e=="object"&&e!==null,be=e=>se(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)&&(typeof e.processStatus=="string"||e.processStatus===null):!1,Z=(e,t)=>{if(!se(e)||!Array.isArray(e.rows)||!e.rows.every(be)||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}},we=({table:e,query:t,initialPage:i,loadPage:A,onChange:P,retryViewport:L,onReload:V,logger:T})=>{const g=new Map,C=new Set;let j=[];const u=new WeakMap,h=new Set;let b=i,w=i.total,d=0,S=!1,k=!1,R;const E=r=>Number.isSafeInteger(r)&&r>=0&&r*t.pageSize<w,v=(r,a,l)=>I(T,{operation:"list",phase:a,tab:t.tab,page:r+1,pageSize:t.pageSize,rowCount:l}),m=()=>{S||P({total:w,rows:j,failed:k||h.size>0,loading:g.size>0})},x=r=>{r.finished||(r.finished=!0,r.removeAbort(),g.get(r.page)===r&&g.delete(r.page),e.markPageLoadFailed(r.page,r.request),r.controller.abort(),v(r.page,"cancel"))},p=r=>{d=r;const a=e.getPagesInView()??[],l=new Set([d,...a].flatMap(c=>[c-1,c,c+1]).filter(E));for(const c of g.values())l.has(c.page)||x(c);for(const c of h)l.has(c)||h.delete(c)},D=(r,a,l)=>{const c=a.rows.map(f=>{const s={...f,statusLabel:ve(f.processStatus)};return u.set(s,f),s});if(!e.setVirtualPageData(c,r,a.total,l)){v(r,"skip");return}w=a.total;try{j=Z({rows:e.getTableData()??[],total:w},Number.MAX_SAFE_INTEGER).rows.map(f=>u.get(f)??f)}catch(f){k=!0,j=[],b=void 0,R&&clearTimeout(R),R=void 0;for(const s of g.values())x(s);throw f}b&&b.total!==w&&(b=void 0),h.delete(r);for(const f of g.values())E(f.page)||x(f);!E(r)&&r>0&&e.scrollToRow(Math.max(0,w-1)),v(r,"success",a.rows.length)},O=()=>{if(S||R)return;const r=[...g.values()].filter(a=>!a.running&&!a.finished).sort((a,l)=>Math.abs(a.page-d)-Math.abs(l.page-d)||a.page-l.page);for(const a of r){if(C.size>=2)break;a.running=!0,C.add(a),v(a.page,"start"),(async()=>{try{const l=await A({...t,page:a.page+1},{signal:a.controller.signal});if(S||a.finished||a.controller.signal.aborted)return;const c=Z(l,t.pageSize);a.finished=!0,a.removeAbort(),g.delete(a.page),D(a.page,c,a.request)}catch{!S&&!a.controller.signal.aborted&&(h.add(a.page),v(a.page,"error"),e.markPageLoadFailed(a.page,a.request))}finally{a.finished||(a.finished=!0,a.removeAbort(),g.get(a.page)===a&&g.delete(a.page)),C.delete(a),m(),O()}})()}m()},B=()=>{R&&clearTimeout(R),R=setTimeout(()=>{R=void 0,O()},120)};return{load(r,a){if(a.useRequestIdentity(),S||k||a.signal.aborted||!E(r)){e.markPageLoadFailed(r,a),v(r,"skip");return}const l=g.get(r);if(l?.request===a&&!l.finished)return;if(l&&x(l),p(r),r===0&&b){const f=b;b=void 0;try{D(0,f,a)}catch{h.add(r),e.markPageLoadFailed(r,a),v(r,"error")}m();return}const c={page:r,request:a,controller:new AbortController,running:!1,finished:!1,removeAbort:()=>{}},K=()=>{x(c),m()};a.signal.addEventListener("abort",K,{once:!0}),c.removeAbort=()=>a.signal.removeEventListener("abort",K),g.set(r,c),B(),m()},viewportChanged(){if(S)return;const r=e.getPagesInView();r?.length&&(p(r[0]),g.size&&B(),m())},retry(){if(!S){if(k){V();return}h.size!==0&&(h.clear(),L(),m())}},dispose(){S=!0,R&&clearTimeout(R),R=void 0;for(const r of g.values())x(r);j=[],h.clear(),b=void 0}}},ye=[{key:"applicationNo",title:"申请单ID",width:260},{key:"applicationType",title:"业务表单",width:180},{key:"applicantName",title:"申请人",width:170},{key:"applicationTime",title:"申请时间",width:220}].map(e=>({...e,showEllipsis:!0,sortable:!1})),re=40,Se=e=>{const t=n.useRef(void 0);return e.initialPage?o.jsx(ke,{...e,initialPage:e.initialPage,restoreScroll:t.current?.query===e.query?t.current.position:void 0,rememberScroll:i=>{t.current={query:e.query,position:i}}}):o.jsx("div",{className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"})},ke=({components:{Button:e},initialPage:t,query:i,provider:A,themeKey:P,onOpen:L,onReload:V,logger:T,restoreScroll:g,rememberScroll:C})=>{const j=n.useRef(null),u=n.useRef(null),h=n.useRef(null),[b,w]=n.useState(!1),[d,S]=n.useState(0),[k,R]=n.useState({...t,failed:!1,loading:!1}),E=n.useRef(t.rows),v=n.useRef(g),m=n.useRef({provider:A,onOpen:L,onReload:V,logger:T,rememberScroll:C});m.current={provider:A,onOpen:L,onReload:V,logger:T,rememberScroll:C};const x=n.useRef(()=>{});return n.useEffect(()=>{const p=j.current;if(!p)return;let D=!1,O,B,r,a,l,c=t.total;I(m.current.logger,{operation:"table",phase:"start"});const K=()=>{D||(w(!0),I(m.current.logger,{operation:"table",phase:"error"}))};return import("@qfei-design/canvas-table").then(f=>{if(D)return;const s=()=>{const H=u.current,F=H?.getScrollState();H&&F&&f.globalEventBus.emitWithNamespace("scroll:change",H.tableId,F)},z=(H=!1)=>{if(!D)try{const{width:F,height:W}=p.getBoundingClientRect();if(F<=0||W<=0||!H&&l?.width===F&&l.height===W)return;const M=getComputedStyle(p),q={rowHeight:re,headerHeight:40,fontSize:14,fontFamily:M.fontFamily||"Arial, sans-serif",...M.color?{textColor:M.color}:{},...M.getPropertyValue("--make-approval-bg").trim()?{rowBgColor:M.getPropertyValue("--make-approval-bg").trim()}:{},...M.getPropertyValue("--make-approval-header").trim()?{headerBgColor:M.getPropertyValue("--make-approval-header").trim()}:{},...M.getPropertyValue("--make-approval-border").trim()?{borderColor:M.getPropertyValue("--make-approval-border").trim()}:{}},ne=Math.max(Math.ceil(300/i.pageSize),Math.ceil(W*3/re/i.pageSize)+2)*i.pageSize,ee={enabled:!0,totalRowCount:c,pageSize:i.pageSize,maxCachedRows:ne};if(u.current){u.current.updateProps({canvasWidth:F,canvasHeight:W,style:q,virtualOptions:ee}),l={width:F,height:W},s();return}u.current=new f.CanvasTableComponent(p,{columns:ye,canvasWidth:F,canvasHeight:W,style:q,rowKey:"id",showSN:{enabled:!0,width:64,formatter:(y,N)=>N+1},virtualOptions:ee,selectable:{enabled:!1},rowSortable:{enabled:!1},editApplyMode:"controlled",customEdit:y=>{y.cancel()},emptyStateOptions:{text:"暂无审批记录"},bodyRowHeadSuffixOptions:{enabled:!0,width:20,render:({group:y,x:N,height:G,rowData:J})=>{const ie=J?.id,U=new f.RectShape({name:"approval-open",x:N,y:G/2-10,cursor:"pointer",tooltip:"查看审批详情",attrs:{width:20,height:20,fill:"transparent",stroke:"transparent"}});U.addChild(new f.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="${M.color||"#64748b"}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)}})),U.on("mousedown",Q=>Q.stopPropagation?.()),U.on("click",Q=>{Q.stopPropagation?.();const te=E.current.find(le=>le.id===ie);te&&m.current.onOpen(te)}),y.addChild(U)}}});const _=u.current;l={width:F,height:W};const Y=we({table:_,query:i,initialPage:t,retryViewport:s,onReload:()=>m.current.onReload(),loadPage:(y,N)=>m.current.provider.loadPage(y,N),logger:y=>I(m.current.logger,y),onChange:y=>{D||(c=y.total,E.current=y.rows,R(N=>N.total===y.total&&N.failed===y.failed&&N.loading===y.loading&&N.rows.length===y.rows.length&&N.rows.every((G,J)=>G===y.rows[J])?N:y))}});h.current=Y,B=f.globalEventBus.onWithNamespace("data:load",_.tableId,(y,N)=>Y.load(y,N)),r=f.globalEventBus.onWithNamespace("scroll:change",_.tableId,()=>Y.viewportChanged()),v.current&&_.scrollTo(v.current.scrollX,v.current.scrollY),w(!1),I(m.current.logger,{operation:"table",phase:"success"})}catch{K()}};x.current=()=>z(!0);const $=()=>z();O=new ResizeObserver($),O.observe(p),window.addEventListener("resize",$),a=()=>window.removeEventListener("resize",$),z()}).catch(K),()=>{D=!0,O?.disconnect(),a?.(),x.current=()=>{},u.current&&(v.current=u.current.getScrollState(),v.current&&m.current.rememberScroll(v.current)),B?.(),r?.(),h.current?.dispose(),h.current=null,u.current?.destroy(),u.current=null,I(m.current.logger,{operation:"table",phase:"destroy"})}},[t,i,d]),n.useEffect(()=>{x.current()},[P]),o.jsxs("div",{className:"make-app-approval-table-frame","aria-busy":k.loading,children:[o.jsx("div",{ref:j,className:"make-app-approval-canvas",role:"group","aria-label":"审批记录表格"}),b&&o.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:["表格加载失败 ",o.jsx(e,{htmlType:"button",variant:"default",onClick:()=>{w(!1),S(p=>p+1)},children:"重新加载表格"})]}),!b&&k.failed&&o.jsxs("div",{className:"make-app-approval-table-feedback",role:"alert",children:["部分审批记录加载失败 ",o.jsx(e,{htmlType:"button",variant:"default",onClick:()=>h.current?.retry(),children:"重试加载"})]}),!b&&!k.failed&&k.loading&&o.jsxs("div",{className:"make-app-approval-table-loading",role:"status","aria-label":"正在加载审批记录","aria-live":"polite",children:[o.jsx("span",{className:"make-app-approval-loading-spinner","aria-hidden":"true"}),o.jsx("span",{children:"加载中"})]}),o.jsxs("ul",{className:"make-app-approval-accessible-rows","aria-label":"审批记录文字视图",children:[k.total===0&&o.jsx("li",{children:"暂无审批记录"}),k.rows.map(p=>o.jsxs("li",{children:[o.jsxs("span",{children:[p.applicationNo,",",p.applicationType,",",p.applicantName,",",p.applicationTime,"。"]}),o.jsxs(e,{htmlType:"button",variant:"text",onClick:()=>L(p),children:["打开 ",p.applicationNo||p.applicationType," 的审批详情"]})]},p.id))]})]})},xe=[],Re=(e,t,i,A)=>{const[P,L]=n.useState(0),[V,T]=n.useState(),g=n.useRef({provider:e,logger:A});g.current={provider:e,logger:A};const C=n.useMemo(()=>({}),[t,i,P]);n.useEffect(()=>{const u=new AbortController,{provider:h,logger:b}=g.current,w={operation:"list",tab:t.tab,page:t.page,pageSize:t.pageSize};I(b,{...w,phase:"start"});let d=!1;return(async()=>{try{if(await Promise.resolve(),u.signal.aborted)return;const S=await h.loadPage(t,{signal:u.signal});if(u.signal.aborted)return;const k=Z(S,t.pageSize);d=!0,T({...k,token:C,status:"success"}),I(b,{...w,phase:"success",rowCount:k.rows.length})}catch{if(u.signal.aborted)return;d=!0,T({token:C,status:"error",rows:xe,total:0}),I(b,{...w,phase:"error"})}})(),()=>{u.abort(),d||I(b,{...w,phase:"cancel"})}},[t,C]);const j=V?.token===C?V:void 0;return{initialPage:j?.status==="success"?j:void 0,total:j?.total??0,status:j?.status??"loading",reload:()=>L(u=>u+1)}},X={keyword:"",applicantId:"",processStatus:"",startDate:"",endDate:""},je=[{value:"pending",label:"待处理"},{value:"approved",label:"已完成"}],oe=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},Ne=({components:e,provider:t,onOpenApproval:i,applicantOptions:A=[],pageSize:P=20,refreshKey:L,themeKey:V,logger:T,className:g})=>{const{Input:C,Select:j,DateRangePicker:u,Button:h,Tabs:b}=e,w=n.useId(),[d,S]=n.useState(X),[k,R]=n.useState(0),[E,v]=n.useState(""),[m,x]=n.useState(""),[p,D]=n.useState({...X,tab:"pending",page:1,pageSize:P}),{initialPage:O,status:B,reload:r}=Re(t,p,L,T),a=n.useRef(!1),l=n.useRef(!0);n.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const c=B==="loading",K=async s=>{if(!a.current){a.current=!0,x(""),I(T,{operation:"open",phase:"start"});try{await i(s),I(T,{operation:"open",phase:"success"})}catch{l.current&&x("审批详情打开失败,请重试"),I(T,{operation:"open",phase:"error"})}finally{a.current=!1}}},f=s=>{s!==p.tab&&(v(""),x(""),D(z=>({...z,tab:s,page:1})))};return o.jsx("section",{className:["make-app-approval",g].filter(Boolean).join(" "),"aria-label":"我的审批",children:o.jsxs(b,{items:je,value:p.tab,onChange:f,ariaLabel:"审批分类",children:[o.jsxs("form",{className:"make-app-approval-filters",onSubmit:s=>{if(s.preventDefault(),!oe(d.startDate)||!oe(d.endDate)){v("请选择有效日期");return}if(d.startDate&&d.endDate&&d.startDate>d.endDate){v("开始日期不能晚于结束日期");return}v(""),x(""),D(z=>({...z,...d,keyword:d.keyword.trim(),page:1}))},children:[o.jsx("div",{className:"make-app-approval-filter-field",children:o.jsx(C,{id:`${w}-keyword`,ariaLabel:"申请单ID",placeholder:"搜索申请单ID",value:d.keyword,onChange:s=>S(z=>({...z,keyword:s}))})}),o.jsx("div",{className:"make-app-approval-date-control",children:o.jsx(u,{id:`${w}-period`,ariaLabel:"申请时间",placeholder:["开始日期","结束日期"],value:[d.startDate,d.endDate],onChange:([s,z])=>S($=>({...$,startDate:s,endDate:z}))},k)}),o.jsx("div",{className:"make-app-approval-filter-field",children:o.jsx(j,{id:`${w}-applicant`,ariaLabel:"申请人",purpose:"applicant",value:d.applicantId??"",options:[{value:"",label:"全部申请人"},...A.filter(s=>s.value!=="")],onChange:s=>S(z=>({...z,applicantId:s}))})}),o.jsxs("div",{className:"make-app-approval-filter-actions",children:[o.jsx(h,{htmlType:"submit",variant:"primary",children:"查询"}),o.jsx(h,{htmlType:"button",variant:"default",onClick:()=>{S(X),R(s=>s+1),v(""),x(""),D(s=>({...s,...X,page:1}))},children:"重置"}),o.jsx(h,{htmlType:"button",variant:"default",disabled:c,loading:c,onClick:r,children:"刷新"})]})]}),E&&o.jsx("p",{role:"alert",className:"make-app-approval-error",children:E}),m&&o.jsx("p",{role:"alert",className:"make-app-approval-error",children:m}),o.jsxs("div",{className:"make-app-approval-results","aria-busy":c,children:[o.jsx(Se,{components:e,initialPage:O,query:p,provider:t,onOpen:s=>{K(s)},onReload:r,themeKey:V,logger:T}),c&&o.jsx("div",{className:"make-app-approval-overlay",role:"status",children:"正在加载审批记录…"}),B==="error"&&o.jsxs("div",{className:"make-app-approval-overlay",role:"alert",children:[o.jsx("span",{children:"审批列表加载失败,请重试"}),o.jsx(h,{htmlType:"button",variant:"default",onClick:r,children:"重试"})]})]})]})})},Pe=e=>{const t=e.pageSize??20;if(!e.scopeKey.trim())throw new Error("MyApprovalsPage requires scopeKey");for(const i of["Input","Select","DateRangePicker","Button","Tabs"])if(!e.components?.[i])throw new Error(`MyApprovalsPage requires components.${i}`);if(!Number.isSafeInteger(t)||t<1||t>200)throw new Error("pageSize must be an integer from 1 to 200");return o.jsx(Ne,{...e,pageSize:t},JSON.stringify([e.scopeKey,t]))};exports.MyApprovalsPage=Pe;
|
package/dist/list.mjs
CHANGED
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { getApprovalStatusDisplay as
|
|
1
|
+
import { jsx as i, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as E, useState as V, useEffect as J, useMemo as de, useId as ue } from "react";
|
|
3
|
+
import { getApprovalStatusDisplay as fe } from "./index.mjs";
|
|
4
4
|
const A = (e, a) => {
|
|
5
5
|
try {
|
|
6
6
|
e ? e(a) : a.phase === "error" ? console.warn("[make-app-approval]", a) : console.info("[make-app-approval]", a);
|
|
7
7
|
} catch {
|
|
8
8
|
console.warn("[make-app-approval] diagnostic sink failed");
|
|
9
9
|
}
|
|
10
|
-
},
|
|
11
|
-
if (!
|
|
10
|
+
}, ge = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : fe(e).label, ie = (e) => typeof e == "object" && e !== null, he = (e) => ie(e) ? ["id", "entityKey", "recordId"].every((a) => typeof e[a] == "string" && e[a].trim().length > 0) && ["applicationNo", "applicationType", "applicantName", "applicationTime"].every((a) => typeof e[a] == "string") && ["taskId", "processInstanceId"].every((a) => e[a] === void 0 || typeof e[a] == "string" && e[a].trim().length > 0) && (typeof e.processStatus == "string" || e.processStatus === null) : !1, te = (e, a) => {
|
|
11
|
+
if (!ie(e) || !Array.isArray(e.rows) || !e.rows.every(he) || typeof e.total != "number" || !Number.isSafeInteger(e.total) || e.total < 0 || e.rows.length > a || e.rows.length > e.total || new Set(e.rows.map((h) => h.id)).size !== e.rows.length)
|
|
12
12
|
throw new Error("Invalid approval page contract");
|
|
13
13
|
return { rows: e.rows, total: e.total };
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
const
|
|
18
|
-
let
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
r.finished || (r.finished = !0, r.removeAbort(),
|
|
14
|
+
}, me = ({ table: e, query: a, initialPage: h, loadPage: F, onChange: H, retryViewport: B, onReload: O, logger: P }) => {
|
|
15
|
+
const u = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Set();
|
|
16
|
+
let R = [];
|
|
17
|
+
const p = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new Set();
|
|
18
|
+
let v = h, b = h.total, c = 0, y = !1, k = !1, N;
|
|
19
|
+
const M = (r) => Number.isSafeInteger(r) && r >= 0 && r * a.pageSize < b, m = (r, t, n) => A(P, { operation: "list", phase: t, tab: a.tab, page: r + 1, pageSize: a.pageSize, rowCount: n }), g = () => {
|
|
20
|
+
y || H({ total: b, rows: R, failed: k || f.size > 0, loading: u.size > 0 });
|
|
21
|
+
}, S = (r) => {
|
|
22
|
+
r.finished || (r.finished = !0, r.removeAbort(), u.get(r.page) === r && u.delete(r.page), e.markPageLoadFailed(r.page, r.request), r.controller.abort(), m(r.page, "cancel"));
|
|
23
23
|
}, l = (r) => {
|
|
24
24
|
c = r;
|
|
25
|
-
const t = e.getPagesInView() ?? [],
|
|
26
|
-
for (const
|
|
27
|
-
for (const
|
|
28
|
-
}, D = (r, t,
|
|
29
|
-
const
|
|
30
|
-
const o = { ...
|
|
31
|
-
return
|
|
25
|
+
const t = e.getPagesInView() ?? [], n = new Set([c, ...t].flatMap((s) => [s - 1, s, s + 1]).filter(M));
|
|
26
|
+
for (const s of u.values()) n.has(s.page) || S(s);
|
|
27
|
+
for (const s of f) n.has(s) || f.delete(s);
|
|
28
|
+
}, D = (r, t, n) => {
|
|
29
|
+
const s = t.rows.map((d) => {
|
|
30
|
+
const o = { ...d, statusLabel: ge(d.processStatus) };
|
|
31
|
+
return p.set(o, d), o;
|
|
32
32
|
});
|
|
33
|
-
if (!e.setVirtualPageData(
|
|
34
|
-
|
|
33
|
+
if (!e.setVirtualPageData(s, r, t.total, n)) {
|
|
34
|
+
m(r, "skip");
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
b = t.total;
|
|
38
38
|
try {
|
|
39
|
-
|
|
40
|
-
} catch (
|
|
41
|
-
|
|
42
|
-
for (const o of
|
|
43
|
-
throw
|
|
39
|
+
R = te({ rows: e.getTableData() ?? [], total: b }, Number.MAX_SAFE_INTEGER).rows.map((d) => p.get(d) ?? d);
|
|
40
|
+
} catch (d) {
|
|
41
|
+
k = !0, R = [], v = void 0, N && clearTimeout(N), N = void 0;
|
|
42
|
+
for (const o of u.values()) S(o);
|
|
43
|
+
throw d;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
for (const
|
|
47
|
-
!
|
|
48
|
-
},
|
|
49
|
-
if (
|
|
50
|
-
const r = [...
|
|
45
|
+
v && v.total !== b && (v = void 0), f.delete(r);
|
|
46
|
+
for (const d of u.values()) M(d.page) || S(d);
|
|
47
|
+
!M(r) && r > 0 && e.scrollToRow(Math.max(0, b - 1)), m(r, "success", t.rows.length);
|
|
48
|
+
}, K = () => {
|
|
49
|
+
if (y || N) return;
|
|
50
|
+
const r = [...u.values()].filter((t) => !t.running && !t.finished).sort((t, n) => Math.abs(t.page - c) - Math.abs(n.page - c) || t.page - n.page);
|
|
51
51
|
for (const t of r) {
|
|
52
|
-
if (
|
|
53
|
-
t.running = !0,
|
|
52
|
+
if (C.size >= 2) break;
|
|
53
|
+
t.running = !0, C.add(t), m(t.page, "start"), (async () => {
|
|
54
54
|
try {
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
t.finished = !0, t.removeAbort(),
|
|
55
|
+
const n = await F({ ...a, page: t.page + 1 }, { signal: t.controller.signal });
|
|
56
|
+
if (y || t.finished || t.controller.signal.aborted) return;
|
|
57
|
+
const s = te(n, a.pageSize);
|
|
58
|
+
t.finished = !0, t.removeAbort(), u.delete(t.page), D(t.page, s, t.request);
|
|
59
59
|
} catch {
|
|
60
|
-
!
|
|
60
|
+
!y && !t.controller.signal.aborted && (f.add(t.page), m(t.page, "error"), e.markPageLoadFailed(t.page, t.request));
|
|
61
61
|
} finally {
|
|
62
|
-
t.finished || (t.finished = !0, t.removeAbort(),
|
|
62
|
+
t.finished || (t.finished = !0, t.removeAbort(), u.get(t.page) === t && u.delete(t.page)), C.delete(t), g(), K();
|
|
63
63
|
}
|
|
64
64
|
})();
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
g();
|
|
67
|
+
}, W = () => {
|
|
68
|
+
N && clearTimeout(N), N = setTimeout(() => {
|
|
69
|
+
N = void 0, K();
|
|
70
70
|
}, 120);
|
|
71
71
|
};
|
|
72
72
|
return {
|
|
73
73
|
load(r, t) {
|
|
74
|
-
if (t.useRequestIdentity(),
|
|
75
|
-
e.markPageLoadFailed(r, t),
|
|
74
|
+
if (t.useRequestIdentity(), y || k || t.signal.aborted || !M(r)) {
|
|
75
|
+
e.markPageLoadFailed(r, t), m(r, "skip");
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
|
|
78
|
+
const n = u.get(r);
|
|
79
|
+
if (n?.request === t && !n.finished) return;
|
|
80
|
+
if (n && S(n), l(r), r === 0 && v) {
|
|
81
|
+
const d = v;
|
|
82
|
+
v = void 0;
|
|
83
83
|
try {
|
|
84
|
-
D(0,
|
|
84
|
+
D(0, d, t);
|
|
85
85
|
} catch {
|
|
86
|
-
|
|
86
|
+
f.add(r), e.markPageLoadFailed(r, t), m(r, "error");
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
g();
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
} },
|
|
93
|
-
|
|
91
|
+
const s = { page: r, request: t, controller: new AbortController(), running: !1, finished: !1, removeAbort: () => {
|
|
92
|
+
} }, $ = () => {
|
|
93
|
+
S(s), g();
|
|
94
94
|
};
|
|
95
|
-
t.signal.addEventListener("abort",
|
|
95
|
+
t.signal.addEventListener("abort", $, { once: !0 }), s.removeAbort = () => t.signal.removeEventListener("abort", $), u.set(r, s), W(), g();
|
|
96
96
|
},
|
|
97
97
|
viewportChanged() {
|
|
98
|
-
if (
|
|
98
|
+
if (y) return;
|
|
99
99
|
const r = e.getPagesInView();
|
|
100
|
-
r?.length && (l(r[0]),
|
|
100
|
+
r?.length && (l(r[0]), u.size && W(), g());
|
|
101
101
|
},
|
|
102
102
|
retry() {
|
|
103
|
-
if (!
|
|
104
|
-
if (
|
|
103
|
+
if (!y) {
|
|
104
|
+
if (k) {
|
|
105
105
|
O();
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
f.size !== 0 && (f.clear(), B(), g());
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
dispose() {
|
|
112
|
-
|
|
113
|
-
for (const r of
|
|
114
|
-
|
|
112
|
+
y = !0, N && clearTimeout(N), N = void 0;
|
|
113
|
+
for (const r of u.values()) S(r);
|
|
114
|
+
R = [], f.clear(), v = void 0;
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
},
|
|
117
|
+
}, ve = [
|
|
118
118
|
{ key: "applicationNo", title: "申请单ID", width: 260 },
|
|
119
119
|
{ key: "applicationType", title: "业务表单", width: 180 },
|
|
120
120
|
{ key: "applicantName", title: "申请人", width: 170 },
|
|
121
121
|
{ key: "applicationTime", title: "申请时间", width: 220 }
|
|
122
|
-
].map((e) => ({ ...e, showEllipsis: !0, sortable: !1 })),
|
|
123
|
-
const a =
|
|
124
|
-
return e.initialPage ? /* @__PURE__ */
|
|
125
|
-
|
|
122
|
+
].map((e) => ({ ...e, showEllipsis: !0, sortable: !1 })), ne = 40, be = (e) => {
|
|
123
|
+
const a = E(void 0);
|
|
124
|
+
return e.initialPage ? /* @__PURE__ */ i(
|
|
125
|
+
we,
|
|
126
126
|
{
|
|
127
127
|
...e,
|
|
128
128
|
initialPage: e.initialPage,
|
|
129
129
|
restoreScroll: a.current?.query === e.query ? a.current.position : void 0,
|
|
130
|
-
rememberScroll: (
|
|
131
|
-
a.current = { query: e.query, position:
|
|
130
|
+
rememberScroll: (h) => {
|
|
131
|
+
a.current = { query: e.query, position: h };
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
) : /* @__PURE__ */
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
const
|
|
134
|
+
) : /* @__PURE__ */ i("div", { className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" });
|
|
135
|
+
}, we = ({ components: { Button: e }, initialPage: a, query: h, provider: F, themeKey: H, onOpen: B, onReload: O, logger: P, restoreScroll: u, rememberScroll: C }) => {
|
|
136
|
+
const R = E(null), p = E(null), f = E(null), [v, b] = V(!1), [c, y] = V(0), [k, N] = V({ ...a, failed: !1, loading: !1 }), M = E(a.rows), m = E(u), g = E({ provider: F, onOpen: B, onReload: O, logger: P, rememberScroll: C });
|
|
137
|
+
g.current = { provider: F, onOpen: B, onReload: O, logger: P, rememberScroll: C };
|
|
138
|
+
const S = E(() => {
|
|
139
139
|
});
|
|
140
|
-
return
|
|
141
|
-
const l =
|
|
140
|
+
return J(() => {
|
|
141
|
+
const l = R.current;
|
|
142
142
|
if (!l) return;
|
|
143
|
-
let D = !1,
|
|
144
|
-
A(
|
|
145
|
-
const
|
|
146
|
-
D || (
|
|
143
|
+
let D = !1, K, W, r, t, n, s = a.total;
|
|
144
|
+
A(g.current.logger, { operation: "table", phase: "start" });
|
|
145
|
+
const $ = () => {
|
|
146
|
+
D || (b(!0), A(g.current.logger, { operation: "table", phase: "error" }));
|
|
147
147
|
};
|
|
148
|
-
return import("@qfei-design/canvas-table").then((
|
|
148
|
+
return import("@qfei-design/canvas-table").then((d) => {
|
|
149
149
|
if (D) return;
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
},
|
|
150
|
+
const o = () => {
|
|
151
|
+
const j = p.current, x = j?.getScrollState();
|
|
152
|
+
j && x && d.globalEventBus.emitWithNamespace("scroll:change", j.tableId, x);
|
|
153
|
+
}, z = (j = !1) => {
|
|
154
154
|
if (!D)
|
|
155
155
|
try {
|
|
156
|
-
const { width:
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
rowHeight:
|
|
156
|
+
const { width: x, height: _ } = l.getBoundingClientRect();
|
|
157
|
+
if (x <= 0 || _ <= 0 || !j && n?.width === x && n.height === _) return;
|
|
158
|
+
const L = getComputedStyle(l), ae = {
|
|
159
|
+
rowHeight: ne,
|
|
160
160
|
headerHeight: 40,
|
|
161
161
|
fontSize: 14,
|
|
162
|
-
fontFamily:
|
|
163
|
-
...
|
|
164
|
-
...
|
|
165
|
-
...
|
|
166
|
-
...
|
|
167
|
-
},
|
|
168
|
-
if (
|
|
169
|
-
|
|
162
|
+
fontFamily: L.fontFamily || "Arial, sans-serif",
|
|
163
|
+
...L.color ? { textColor: L.color } : {},
|
|
164
|
+
...L.getPropertyValue("--make-approval-bg").trim() ? { rowBgColor: L.getPropertyValue("--make-approval-bg").trim() } : {},
|
|
165
|
+
...L.getPropertyValue("--make-approval-header").trim() ? { headerBgColor: L.getPropertyValue("--make-approval-header").trim() } : {},
|
|
166
|
+
...L.getPropertyValue("--make-approval-border").trim() ? { borderColor: L.getPropertyValue("--make-approval-border").trim() } : {}
|
|
167
|
+
}, le = Math.max(Math.ceil(300 / h.pageSize), Math.ceil(_ * 3 / ne / h.pageSize) + 2) * h.pageSize, re = { enabled: !0, totalRowCount: s, pageSize: h.pageSize, maxCachedRows: le };
|
|
168
|
+
if (p.current) {
|
|
169
|
+
p.current.updateProps({ canvasWidth: x, canvasHeight: _, style: ae, virtualOptions: re }), n = { width: x, height: _ }, o();
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
columns:
|
|
174
|
-
canvasWidth:
|
|
175
|
-
canvasHeight:
|
|
176
|
-
style:
|
|
172
|
+
p.current = new d.CanvasTableComponent(l, {
|
|
173
|
+
columns: ve,
|
|
174
|
+
canvasWidth: x,
|
|
175
|
+
canvasHeight: _,
|
|
176
|
+
style: ae,
|
|
177
177
|
rowKey: "id",
|
|
178
|
-
showSN: { enabled: !0, width: 64, formatter: (w,
|
|
179
|
-
virtualOptions:
|
|
178
|
+
showSN: { enabled: !0, width: 64, formatter: (w, T) => T + 1 },
|
|
179
|
+
virtualOptions: re,
|
|
180
180
|
selectable: { enabled: !1 },
|
|
181
181
|
rowSortable: { enabled: !1 },
|
|
182
182
|
editApplyMode: "controlled",
|
|
@@ -187,65 +187,69 @@ const A = (e, a) => {
|
|
|
187
187
|
bodyRowHeadSuffixOptions: {
|
|
188
188
|
enabled: !0,
|
|
189
189
|
width: 20,
|
|
190
|
-
render: ({ group: w, x:
|
|
191
|
-
const
|
|
192
|
-
|
|
190
|
+
render: ({ group: w, x: T, height: Z, rowData: q }) => {
|
|
191
|
+
const ce = q?.id, Y = new d.RectShape({ name: "approval-open", x: T, y: Z / 2 - 10, cursor: "pointer", tooltip: "查看审批详情", attrs: { width: 20, height: 20, fill: "transparent", stroke: "transparent" } });
|
|
192
|
+
Y.addChild(new d.ImgShape({ name: "approval-open-icon", x: 3, y: 3, attrs: {
|
|
193
193
|
width: 14,
|
|
194
194
|
height: 14,
|
|
195
|
-
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="${
|
|
196
|
-
} })),
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
}), w.addChild(
|
|
195
|
+
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="${L.color || "#64748b"}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)
|
|
196
|
+
} })), Y.on("mousedown", (ee) => ee.stopPropagation?.()), Y.on("click", (ee) => {
|
|
197
|
+
ee.stopPropagation?.();
|
|
198
|
+
const oe = M.current.find((pe) => pe.id === ce);
|
|
199
|
+
oe && g.current.onOpen(oe);
|
|
200
|
+
}), w.addChild(Y);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
const X = p.current;
|
|
205
|
+
n = { width: x, height: _ };
|
|
206
|
+
const Q = me({
|
|
207
|
+
table: X,
|
|
208
|
+
query: h,
|
|
207
209
|
initialPage: a,
|
|
208
210
|
// 公开滚动同步事件会重新检测缺页,不移动视口,也不复用失败身份。
|
|
209
|
-
retryViewport:
|
|
210
|
-
onReload: () =>
|
|
211
|
-
loadPage: (w,
|
|
212
|
-
logger: (w) => A(
|
|
211
|
+
retryViewport: o,
|
|
212
|
+
onReload: () => g.current.onReload(),
|
|
213
|
+
loadPage: (w, T) => g.current.provider.loadPage(w, T),
|
|
214
|
+
logger: (w) => A(g.current.logger, w),
|
|
213
215
|
onChange: (w) => {
|
|
214
|
-
D || (
|
|
216
|
+
D || (s = w.total, M.current = w.rows, N((T) => T.total === w.total && T.failed === w.failed && T.loading === w.loading && T.rows.length === w.rows.length && T.rows.every((Z, q) => Z === w.rows[q]) ? T : w));
|
|
215
217
|
}
|
|
216
218
|
});
|
|
217
|
-
|
|
219
|
+
f.current = Q, W = d.globalEventBus.onWithNamespace("data:load", X.tableId, (w, T) => Q.load(w, T)), r = d.globalEventBus.onWithNamespace("scroll:change", X.tableId, () => Q.viewportChanged()), m.current && X.scrollTo(m.current.scrollX, m.current.scrollY), b(!1), A(g.current.logger, { operation: "table", phase: "success" });
|
|
218
220
|
} catch {
|
|
219
|
-
|
|
221
|
+
$();
|
|
220
222
|
}
|
|
221
223
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
S.current = () => z(!0);
|
|
225
|
+
const U = () => z();
|
|
226
|
+
K = new ResizeObserver(U), K.observe(l), window.addEventListener("resize", U), t = () => window.removeEventListener("resize", U), z();
|
|
227
|
+
}).catch($), () => {
|
|
228
|
+
D = !0, K?.disconnect(), t?.(), S.current = () => {
|
|
229
|
+
}, p.current && (m.current = p.current.getScrollState(), m.current && g.current.rememberScroll(m.current)), W?.(), r?.(), f.current?.dispose(), f.current = null, p.current?.destroy(), p.current = null, A(g.current.logger, { operation: "table", phase: "destroy" });
|
|
226
230
|
};
|
|
227
|
-
}, [a,
|
|
228
|
-
|
|
229
|
-
}, [
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
231
|
+
}, [a, h, c]), J(() => {
|
|
232
|
+
S.current();
|
|
233
|
+
}, [H]), /* @__PURE__ */ I("div", { className: "make-app-approval-table-frame", "aria-busy": k.loading, children: [
|
|
234
|
+
/* @__PURE__ */ i("div", { ref: R, className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" }),
|
|
235
|
+
v && /* @__PURE__ */ I("div", { className: "make-app-approval-overlay", role: "alert", children: [
|
|
232
236
|
"表格加载失败 ",
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
|
|
237
|
+
/* @__PURE__ */ i(e, { htmlType: "button", variant: "default", onClick: () => {
|
|
238
|
+
b(!1), y((l) => l + 1);
|
|
235
239
|
}, children: "重新加载表格" })
|
|
236
240
|
] }),
|
|
237
|
-
!
|
|
241
|
+
!v && k.failed && /* @__PURE__ */ I("div", { className: "make-app-approval-table-feedback", role: "alert", children: [
|
|
238
242
|
"部分审批记录加载失败 ",
|
|
239
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ i(e, { htmlType: "button", variant: "default", onClick: () => f.current?.retry(), children: "重试加载" })
|
|
240
244
|
] }),
|
|
241
|
-
!
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
245
|
+
!v && !k.failed && k.loading && /* @__PURE__ */ I("div", { className: "make-app-approval-table-loading", role: "status", "aria-label": "正在加载审批记录", "aria-live": "polite", children: [
|
|
246
|
+
/* @__PURE__ */ i("span", { className: "make-app-approval-loading-spinner", "aria-hidden": "true" }),
|
|
247
|
+
/* @__PURE__ */ i("span", { children: "加载中" })
|
|
244
248
|
] }),
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ I("ul", { className: "make-app-approval-accessible-rows", "aria-label": "审批记录文字视图", children: [
|
|
250
|
+
k.total === 0 && /* @__PURE__ */ i("li", { children: "暂无审批记录" }),
|
|
251
|
+
k.rows.map((l) => /* @__PURE__ */ I("li", { children: [
|
|
252
|
+
/* @__PURE__ */ I("span", { children: [
|
|
249
253
|
l.applicationNo,
|
|
250
254
|
",",
|
|
251
255
|
l.applicationType,
|
|
@@ -255,7 +259,7 @@ const A = (e, a) => {
|
|
|
255
259
|
l.applicationTime,
|
|
256
260
|
"。"
|
|
257
261
|
] }),
|
|
258
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ I(e, { htmlType: "button", variant: "text", onClick: () => B(l), children: [
|
|
259
263
|
"打开 ",
|
|
260
264
|
l.applicationNo || l.applicationType,
|
|
261
265
|
" 的审批详情"
|
|
@@ -263,124 +267,124 @@ const A = (e, a) => {
|
|
|
263
267
|
] }, l.id))
|
|
264
268
|
] })
|
|
265
269
|
] });
|
|
266
|
-
},
|
|
267
|
-
const [
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
A(
|
|
270
|
+
}, ye = [], ke = (e, a, h, F) => {
|
|
271
|
+
const [H, B] = V(0), [O, P] = V(), u = E({ provider: e, logger: F });
|
|
272
|
+
u.current = { provider: e, logger: F };
|
|
273
|
+
const C = de(() => ({}), [a, h, H]);
|
|
274
|
+
J(() => {
|
|
275
|
+
const p = new AbortController(), { provider: f, logger: v } = u.current, b = { operation: "list", tab: a.tab, page: a.page, pageSize: a.pageSize };
|
|
276
|
+
A(v, { ...b, phase: "start" });
|
|
273
277
|
let c = !1;
|
|
274
278
|
return (async () => {
|
|
275
279
|
try {
|
|
276
|
-
if (await Promise.resolve(),
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
c = !0,
|
|
280
|
+
if (await Promise.resolve(), p.signal.aborted) return;
|
|
281
|
+
const y = await f.loadPage(a, { signal: p.signal });
|
|
282
|
+
if (p.signal.aborted) return;
|
|
283
|
+
const k = te(y, a.pageSize);
|
|
284
|
+
c = !0, P({ ...k, token: C, status: "success" }), A(v, { ...b, phase: "success", rowCount: k.rows.length });
|
|
281
285
|
} catch {
|
|
282
|
-
if (
|
|
283
|
-
c = !0,
|
|
286
|
+
if (p.signal.aborted) return;
|
|
287
|
+
c = !0, P({ token: C, status: "error", rows: ye, total: 0 }), A(v, { ...b, phase: "error" });
|
|
284
288
|
}
|
|
285
289
|
})(), () => {
|
|
286
|
-
|
|
290
|
+
p.abort(), c || A(v, { ...b, phase: "cancel" });
|
|
287
291
|
};
|
|
288
|
-
}, [a,
|
|
289
|
-
const
|
|
292
|
+
}, [a, C]);
|
|
293
|
+
const R = O?.token === C ? O : void 0;
|
|
290
294
|
return {
|
|
291
|
-
initialPage:
|
|
292
|
-
total:
|
|
293
|
-
status:
|
|
294
|
-
reload: () => B((
|
|
295
|
+
initialPage: R?.status === "success" ? R : void 0,
|
|
296
|
+
total: R?.total ?? 0,
|
|
297
|
+
status: R?.status ?? "loading",
|
|
298
|
+
reload: () => B((p) => p + 1)
|
|
295
299
|
};
|
|
296
|
-
},
|
|
300
|
+
}, G = { keyword: "", applicantId: "", processStatus: "", startDate: "", endDate: "" }, Se = [{ value: "pending", label: "待处理" }, { value: "approved", label: "已完成" }], se = (e) => {
|
|
297
301
|
if (e === "") return !0;
|
|
298
302
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
|
|
299
303
|
const a = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
300
304
|
return Number.isFinite(a.getTime()) && a.toISOString().slice(0, 10) === e;
|
|
301
|
-
},
|
|
302
|
-
const { Input:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
+
}, Ne = ({ components: e, provider: a, onOpenApproval: h, applicantOptions: F = [], pageSize: H = 20, refreshKey: B, themeKey: O, logger: P, className: u }) => {
|
|
306
|
+
const { Input: C, Select: R, DateRangePicker: p, Button: f, Tabs: v } = e, b = ue(), [c, y] = V(G), [k, N] = V(0), [M, m] = V(""), [g, S] = V(""), [l, D] = V({ ...G, tab: "pending", page: 1, pageSize: H }), { initialPage: K, status: W, reload: r } = ke(a, l, B, P), t = E(!1), n = E(!0);
|
|
307
|
+
J(() => (n.current = !0, () => {
|
|
308
|
+
n.current = !1;
|
|
305
309
|
}), []);
|
|
306
|
-
const
|
|
310
|
+
const s = W === "loading", $ = async (o) => {
|
|
307
311
|
if (!t.current) {
|
|
308
|
-
t.current = !0,
|
|
312
|
+
t.current = !0, S(""), A(P, { operation: "open", phase: "start" });
|
|
309
313
|
try {
|
|
310
|
-
await
|
|
314
|
+
await h(o), A(P, { operation: "open", phase: "success" });
|
|
311
315
|
} catch {
|
|
312
|
-
|
|
316
|
+
n.current && S("审批详情打开失败,请重试"), A(P, { operation: "open", phase: "error" });
|
|
313
317
|
} finally {
|
|
314
318
|
t.current = !1;
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
|
-
},
|
|
318
|
-
o !== l.tab && (
|
|
321
|
+
}, d = (o) => {
|
|
322
|
+
o !== l.tab && (m(""), S(""), D((z) => ({ ...z, tab: o, page: 1 })));
|
|
319
323
|
};
|
|
320
|
-
return /* @__PURE__ */
|
|
321
|
-
/* @__PURE__ */
|
|
322
|
-
if (o.preventDefault(), !
|
|
323
|
-
|
|
324
|
+
return /* @__PURE__ */ i("section", { className: ["make-app-approval", u].filter(Boolean).join(" "), "aria-label": "我的审批", children: /* @__PURE__ */ I(v, { items: Se, value: l.tab, onChange: d, ariaLabel: "审批分类", children: [
|
|
325
|
+
/* @__PURE__ */ I("form", { className: "make-app-approval-filters", onSubmit: (o) => {
|
|
326
|
+
if (o.preventDefault(), !se(c.startDate) || !se(c.endDate)) {
|
|
327
|
+
m("请选择有效日期");
|
|
324
328
|
return;
|
|
325
329
|
}
|
|
326
330
|
if (c.startDate && c.endDate && c.startDate > c.endDate) {
|
|
327
|
-
|
|
331
|
+
m("开始日期不能晚于结束日期");
|
|
328
332
|
return;
|
|
329
333
|
}
|
|
330
|
-
|
|
334
|
+
m(""), S(""), D((z) => ({ ...z, ...c, keyword: c.keyword.trim(), page: 1 }));
|
|
331
335
|
}, children: [
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
|
|
336
|
+
/* @__PURE__ */ i("div", { className: "make-app-approval-filter-field", children: /* @__PURE__ */ i(C, { id: `${b}-keyword`, ariaLabel: "申请单ID", placeholder: "搜索申请单ID", value: c.keyword, onChange: (o) => y((z) => ({ ...z, keyword: o })) }) }),
|
|
337
|
+
/* @__PURE__ */ i("div", { className: "make-app-approval-date-control", children: /* @__PURE__ */ i(
|
|
338
|
+
p,
|
|
335
339
|
{
|
|
336
|
-
id: `${
|
|
340
|
+
id: `${b}-period`,
|
|
337
341
|
ariaLabel: "申请时间",
|
|
338
342
|
placeholder: ["开始日期", "结束日期"],
|
|
339
343
|
value: [c.startDate, c.endDate],
|
|
340
|
-
onChange: ([o,
|
|
344
|
+
onChange: ([o, z]) => y((U) => ({ ...U, startDate: o, endDate: z }))
|
|
341
345
|
},
|
|
342
|
-
|
|
346
|
+
k
|
|
343
347
|
) }),
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
-
|
|
348
|
+
/* @__PURE__ */ i("div", { className: "make-app-approval-filter-field", children: /* @__PURE__ */ i(
|
|
349
|
+
R,
|
|
346
350
|
{
|
|
347
|
-
id: `${
|
|
351
|
+
id: `${b}-applicant`,
|
|
348
352
|
ariaLabel: "申请人",
|
|
349
353
|
purpose: "applicant",
|
|
350
354
|
value: c.applicantId ?? "",
|
|
351
355
|
options: [{ value: "", label: "全部申请人" }, ...F.filter((o) => o.value !== "")],
|
|
352
|
-
onChange: (o) =>
|
|
356
|
+
onChange: (o) => y((z) => ({ ...z, applicantId: o }))
|
|
353
357
|
}
|
|
354
358
|
) }),
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
/* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
|
|
359
|
+
/* @__PURE__ */ I("div", { className: "make-app-approval-filter-actions", children: [
|
|
360
|
+
/* @__PURE__ */ i(f, { htmlType: "submit", variant: "primary", children: "查询" }),
|
|
361
|
+
/* @__PURE__ */ i(f, { htmlType: "button", variant: "default", onClick: () => {
|
|
362
|
+
y(G), N((o) => o + 1), m(""), S(""), D((o) => ({ ...o, ...G, page: 1 }));
|
|
359
363
|
}, children: "重置" }),
|
|
360
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ i(f, { htmlType: "button", variant: "default", disabled: s, loading: s, onClick: r, children: "刷新" })
|
|
361
365
|
] })
|
|
362
366
|
] }),
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
|
|
368
|
-
}, onReload: r, themeKey: O, logger:
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
-
/* @__PURE__ */
|
|
367
|
+
M && /* @__PURE__ */ i("p", { role: "alert", className: "make-app-approval-error", children: M }),
|
|
368
|
+
g && /* @__PURE__ */ i("p", { role: "alert", className: "make-app-approval-error", children: g }),
|
|
369
|
+
/* @__PURE__ */ I("div", { className: "make-app-approval-results", "aria-busy": s, children: [
|
|
370
|
+
/* @__PURE__ */ i(be, { components: e, initialPage: K, query: l, provider: a, onOpen: (o) => {
|
|
371
|
+
$(o);
|
|
372
|
+
}, onReload: r, themeKey: O, logger: P }),
|
|
373
|
+
s && /* @__PURE__ */ i("div", { className: "make-app-approval-overlay", role: "status", children: "正在加载审批记录…" }),
|
|
374
|
+
W === "error" && /* @__PURE__ */ I("div", { className: "make-app-approval-overlay", role: "alert", children: [
|
|
375
|
+
/* @__PURE__ */ i("span", { children: "审批列表加载失败,请重试" }),
|
|
376
|
+
/* @__PURE__ */ i(f, { htmlType: "button", variant: "default", onClick: r, children: "重试" })
|
|
373
377
|
] })
|
|
374
378
|
] })
|
|
375
379
|
] }) });
|
|
376
|
-
},
|
|
380
|
+
}, Ce = (e) => {
|
|
377
381
|
const a = e.pageSize ?? 20;
|
|
378
382
|
if (!e.scopeKey.trim()) throw new Error("MyApprovalsPage requires scopeKey");
|
|
379
|
-
for (const
|
|
380
|
-
if (!e.components?.[
|
|
383
|
+
for (const h of ["Input", "Select", "DateRangePicker", "Button", "Tabs"])
|
|
384
|
+
if (!e.components?.[h]) throw new Error(`MyApprovalsPage requires components.${h}`);
|
|
381
385
|
if (!Number.isSafeInteger(a) || a < 1 || a > 200) throw new Error("pageSize must be an integer from 1 to 200");
|
|
382
|
-
return /* @__PURE__ */
|
|
386
|
+
return /* @__PURE__ */ i(Ne, { ...e, pageSize: a }, JSON.stringify([e.scopeKey, a]));
|
|
383
387
|
};
|
|
384
388
|
export {
|
|
385
|
-
|
|
389
|
+
Ce as MyApprovalsPage
|
|
386
390
|
};
|
package/docs/publishing.md
CHANGED