@ys-knife-crud/antd 0.0.0-stage → 0.0.7

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.
Files changed (76) hide show
  1. package/dist/antd/src/advancedFilter/advancedConditionGroup.d.ts +13 -0
  2. package/dist/antd/src/advancedFilter/advancedConditionGroup.d.ts.map +1 -0
  3. package/dist/antd/src/advancedFilter/advancedFilterContext.d.ts +40 -0
  4. package/dist/antd/src/advancedFilter/advancedFilterContext.d.ts.map +1 -0
  5. package/dist/antd/src/advancedFilter/advancedFilterPanel.d.ts +44 -0
  6. package/dist/antd/src/advancedFilter/advancedFilterPanel.d.ts.map +1 -0
  7. package/dist/antd/src/advancedFilter/advancedValueEditor.d.ts +30 -0
  8. package/dist/antd/src/advancedFilter/advancedValueEditor.d.ts.map +1 -0
  9. package/dist/antd/src/commandBar/commandBar.d.ts +24 -0
  10. package/dist/antd/src/commandBar/commandBar.d.ts.map +1 -0
  11. package/dist/antd/src/commandBar/tableActionMenuButton.d.ts +22 -0
  12. package/dist/antd/src/commandBar/tableActionMenuButton.d.ts.map +1 -0
  13. package/dist/antd/src/filter/dateFilterItem.d.ts +21 -0
  14. package/dist/antd/src/filter/dateFilterItem.d.ts.map +1 -0
  15. package/dist/antd/src/filter/dateRangeFilterItem.d.ts +23 -0
  16. package/dist/antd/src/filter/dateRangeFilterItem.d.ts.map +1 -0
  17. package/dist/antd/src/filter/enumFilterItem.d.ts +25 -0
  18. package/dist/antd/src/filter/enumFilterItem.d.ts.map +1 -0
  19. package/dist/antd/src/filter/filterItemLayout.d.ts +19 -0
  20. package/dist/antd/src/filter/filterItemLayout.d.ts.map +1 -0
  21. package/dist/antd/src/filter/filterPanel.d.ts +54 -0
  22. package/dist/antd/src/filter/filterPanel.d.ts.map +1 -0
  23. package/dist/antd/src/filter/rootFilterPanel.d.ts +27 -0
  24. package/dist/antd/src/filter/rootFilterPanel.d.ts.map +1 -0
  25. package/dist/antd/src/filter/textFilterItem.d.ts +19 -0
  26. package/dist/antd/src/filter/textFilterItem.d.ts.map +1 -0
  27. package/dist/antd/src/importExcel/formatCell.d.ts +3 -0
  28. package/dist/antd/src/importExcel/formatCell.d.ts.map +1 -0
  29. package/dist/antd/src/importExcel/importExcel.d.ts +53 -0
  30. package/dist/antd/src/importExcel/importExcel.d.ts.map +1 -0
  31. package/dist/antd/src/importExcel/importRowEditDialog.d.ts +29 -0
  32. package/dist/antd/src/importExcel/importRowEditDialog.d.ts.map +1 -0
  33. package/dist/antd/src/index.d.ts +45 -0
  34. package/dist/antd/src/index.d.ts.map +1 -0
  35. package/dist/antd/src/mainPanel/mainPanel.d.ts +27 -0
  36. package/dist/antd/src/mainPanel/mainPanel.d.ts.map +1 -0
  37. package/dist/antd/src/mainPanel/mainPanelMenuNode.d.ts +16 -0
  38. package/dist/antd/src/mainPanel/mainPanelMenuNode.d.ts.map +1 -0
  39. package/dist/antd/src/modal/openDialog.d.ts +10 -0
  40. package/dist/antd/src/modal/openDialog.d.ts.map +1 -0
  41. package/dist/antd/src/modal/openModal.d.ts +3 -0
  42. package/dist/antd/src/modal/openModal.d.ts.map +1 -0
  43. package/dist/antd/src/shared/button.d.ts +9 -0
  44. package/dist/antd/src/shared/button.d.ts.map +1 -0
  45. package/dist/antd/src/shared/icon.d.ts +7 -0
  46. package/dist/antd/src/shared/icon.d.ts.map +1 -0
  47. package/dist/antd/src/table/cardView.d.ts +22 -0
  48. package/dist/antd/src/table/cardView.d.ts.map +1 -0
  49. package/dist/antd/src/table/columnConfigDialog.d.ts +23 -0
  50. package/dist/antd/src/table/columnConfigDialog.d.ts.map +1 -0
  51. package/dist/antd/src/table/contextMenu.d.ts +21 -0
  52. package/dist/antd/src/table/contextMenu.d.ts.map +1 -0
  53. package/dist/antd/src/table/exportExcelDialog.d.ts +31 -0
  54. package/dist/antd/src/table/exportExcelDialog.d.ts.map +1 -0
  55. package/dist/antd/src/table/infiniteList.d.ts +85 -0
  56. package/dist/antd/src/table/infiniteList.d.ts.map +1 -0
  57. package/dist/antd/src/table/listView.d.ts +22 -0
  58. package/dist/antd/src/table/listView.d.ts.map +1 -0
  59. package/dist/antd/src/table/rowActionsColumn.d.ts +19 -0
  60. package/dist/antd/src/table/rowActionsColumn.d.ts.map +1 -0
  61. package/dist/antd/src/table/selectionBar.d.ts +18 -0
  62. package/dist/antd/src/table/selectionBar.d.ts.map +1 -0
  63. package/dist/antd/src/table/table.d.ts +54 -0
  64. package/dist/antd/src/table/table.d.ts.map +1 -0
  65. package/dist/antd/src/tablepage/tablePage.d.ts +87 -0
  66. package/dist/antd/src/tablepage/tablePage.d.ts.map +1 -0
  67. package/dist/antd/src/tablepage/tablePageTypes.d.ts +9 -0
  68. package/dist/antd/src/tablepage/tablePageTypes.d.ts.map +1 -0
  69. package/dist/index.cjs +2 -0
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.css +1 -0
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.js +3849 -0
  74. package/dist/index.js.map +1 -0
  75. package/package.json +66 -3
  76. package/README.md +0 -3
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const t=require("react/jsx-runtime"),i=require("react"),u=require("antd"),V=require("@ys-knife-crud/react"),bn=require("react-dom"),S=require("@ys-knife-crud/core"),$e=require("dayjs");function hr(n){const{rows:e,rowKey:r,showCheckbox:s,loading:l,hasActions:a,isSelected:c,onCheck:o,onContextMenu:d,card:m,empty:k}=n;return t.jsxs("div",{className:"yk-table__cards",children:[e.map((b,w)=>{const p=s&&c(b);return t.jsxs("div",{className:`yk-table__card${p?" is-selected":""}${a?" has-actions":""}`,title:a?"右键查看行操作":void 0,onContextMenu:j=>d(j,b),children:[s?t.jsx(u.Checkbox,{className:"yk-table__card-checkbox",checked:p,onChange:j=>o(b,j.target.checked)}):null,m?m(b,w):t.jsx("pre",{className:"yk-table__card-json",children:JSON.stringify(b,null,2)})]},String(b[r]))}),!l&&e.length===0?t.jsx(t.Fragment,{children:k??t.jsx(u.Empty,{className:"yk-table__cards-empty",description:"暂无数据"})}):null]})}function gn(n,e,r){return n.map((s,l)=>l===e?{...s,...r}:s)}function yr({open:n,drafts:e,onCancel:r,onSave:s,onReset:l,onMove:a,onDraftsChange:c}){return t.jsx(u.Modal,{open:n,title:"列设置",width:480,destroyOnClose:!0,onCancel:r,footer:t.jsxs(t.Fragment,{children:[t.jsx(u.Button,{onClick:l,children:"重置"}),t.jsx(u.Button,{onClick:r,children:"取消"}),t.jsx(u.Button,{type:"primary",className:"yk-col-config-save",onClick:()=>void s(),children:"保存"})]}),children:t.jsx("div",{className:"yk-col-config",children:e.map((o,d)=>t.jsxs("div",{className:"yk-col-config-row",children:[t.jsx(u.Checkbox,{className:"yk-col-config-name",checked:o.visible,onChange:m=>c(gn(e,d,{visible:m.target.checked})),children:o.displayName}),t.jsx(u.Input,{className:"yk-col-config-width",size:"small",value:o.width,placeholder:"宽度(如 120)",onChange:m=>c(gn(e,d,{width:m.target.value}))}),t.jsx(u.Button,{type:"link",disabled:d===0,onClick:()=>a(d,-1),children:"上移"}),t.jsx(u.Button,{type:"link",disabled:d===e.length-1,onClick:()=>a(d,1),children:"下移"})]},o.propertyPath))})})}function vt(n){return n==null||n===!1?null:i.isValidElement(n)||typeof n=="string"||typeof n=="number"?n:typeof n=="function"?i.createElement(n):null}function gr({menu:n,actions:e,isEnabled:r,onClose:s,onSelect:l}){return i.useEffect(()=>{if(!n)return;const a=c=>{c.key==="Escape"&&s()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n,s]),!n||typeof document>"u"?null:bn.createPortal(t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"yk-table__menu-mask",onClick:s,onContextMenu:a=>{a.preventDefault(),s()}}),t.jsx("ul",{className:"yk-table__context-menu",style:{left:n.x,top:n.y},children:e.map(a=>{const c=r(a,n.row);return t.jsxs("li",{className:`yk-table__context-menu-item${c?"":" is-disabled"}`,onClick:()=>{c&&l(a)},children:[a.icon?t.jsx("span",{className:"yk-table__context-menu-icon",children:vt(a.icon)}):null,a.desc]},a.name)})})]}),document.body)}function xr(n){if(n==null)return null;if(n<60)return`${n} 秒`;const e=Math.floor(n/60),r=n%60;return r>0?`${e} 分 ${r} 秒`:`${e} 分`}function jn({open:n,options:e,exporting:r,fetched:s,total:l,totalKnown:a,percent:c,etaSeconds:o,cancelledVisible:d,cancelledRows:m,onExport:k,onCancelExport:b,onKeepPartial:w,onDiscardPartial:p,onClose:j}){const F=xr(o);return t.jsxs(t.Fragment,{children:[t.jsx(u.Modal,{open:n,title:"导出 Excel",width:420,destroyOnClose:!0,onCancel:j,footer:null,children:t.jsx("div",{className:"yk-export-options",children:e.map(R=>t.jsx(u.Button,{block:!0,className:"yk-export-option","data-scope":R.value,disabled:R.disabled,onClick:()=>k(R.value),children:R.label},R.value))})}),t.jsxs(u.Modal,{open:r,title:"正在导出",width:420,closable:!1,maskClosable:!1,keyboard:!1,destroyOnClose:!0,footer:t.jsx(u.Button,{onClick:b,children:"取消"}),children:[t.jsx(u.Progress,{percent:c}),t.jsxs("p",{className:"yk-export-progress-text",children:["已加载 ",s,a?` / ${l}`:""," 条",F?`,预计剩余约 ${F}`:""]})]}),t.jsx(u.Modal,{open:d,title:"导出已取消",width:420,destroyOnClose:!0,onCancel:p,footer:t.jsxs(t.Fragment,{children:[t.jsx(u.Button,{className:"yk-export-discard",onClick:p,children:"丢弃"}),t.jsx(u.Button,{className:"yk-export-keep",type:"primary",onClick:w,children:"保留部分文件"})]}),children:t.jsxs("p",{className:"yk-export-cancelled-text",children:["已写入 ",m," 条数据,是否保留已导出的部分文件?"]})})]})}function pr(n){const{rows:e,rowKey:r,showCheckbox:s,loading:l,hasActions:a,isSelected:c,onCheck:o,onContextMenu:d,list:m,empty:k}=n;return t.jsxs("div",{className:"yk-table__list",children:[e.map((b,w)=>{const p=s&&c(b);return t.jsxs("div",{className:`yk-table__list-item${p?" is-selected":""}${a?" has-actions":""}`,title:a?"右键查看行操作":void 0,onContextMenu:j=>d(j,b),children:[s?t.jsx(u.Checkbox,{className:"yk-table__list-item-checkbox",checked:p,onChange:j=>o(b,j.target.checked)}):null,t.jsx("div",{className:"yk-table__list-item-body",children:m?m(b,w):t.jsx("pre",{className:"yk-table__list-item-json",children:JSON.stringify(b,null,2)})})]},String(b[r]))}),!l&&e.length===0?t.jsx(t.Fragment,{children:k??t.jsx(u.Empty,{description:"暂无数据"})}):null]})}function zt(n,e){return n==="danger"?{type:e?"default":"primary",danger:!0}:n==="primary"?{type:"primary"}:{type:"default"}}function vr({actions:n,table:e,row:r}){return t.jsx("div",{className:"yk-row-actions",children:V.visibleActions(n,r).map(s=>{const l=zt(s.type,!0);return t.jsxs(u.Button,{type:"link",size:"small",danger:l.danger,disabled:!V.isEnabled(s,r),className:"yk-row-action",onClick:()=>void s.execute(r,e),children:[s.icon?t.jsx("span",{className:"yk-row-action__icon",children:vt(s.icon)}):null,s.desc]},s.name)})})}function kr({actions:n,table:e}){return n.length===0?null:{key:"__actions",title:"操作",fixed:"right",width:n.length*34+(n.length-1)*12+30,render:(s,l)=>t.jsx(vr,{actions:n,table:e,row:l})}}const _r=20,br=[10,20,50,100],jr=1e3;function Cr(n){if(!n)return;const e=Number.parseInt(n,10);return Number.isFinite(e)?e:void 0}function xn(n){return n==null?null:i.isValidElement(n)||typeof n=="string"||typeof n=="number"?n:typeof n=="boolean"?n?"true":"false":String(n)}const Cn=i.forwardRef(function(e,r){const s=e.pageSize??_r,l=e.pageSizes??br,a=e.rowKey??"id",c=e.exportPageSize??jr,o=i.useRef(e);o.current=e;const{meta:d,paged:m,rows:k,metaLoading:b,dataLoading:w,currentPage:p,total:j,totalKnown:F,loadMeta:R,setPaged:z,setDataLoading:P,setCurrentPage:L}=V.useDefault({metaFun:e.metaFun,dataFun:e.dataFun,pageSize:s,pageSizes:l}),{selectedRows:v,selectedRowKeys:A,onSelectionChange:$,isRowSelected:J,toggleRowSelection:ue,clearSelection:W,selectAllOnPage:ne,invertSelectionOnPage:U}=V.useSelection({rows:k,rowKey:a}),{actions:Q,actionsLoading:X,loadActions:K}=V.useRowActions({rowActionsFunc:e.rowActionsFunc}),{customConfigs:le,customConfigLoading:T,defaultPageSize:f,configDialogVisible:N,columns:M,loadCustomConfigs:B,updateDefaultPageSize:E,updateColumnWidth:G,openConfigDialog:q,closeConfigDialog:Z}=V.useCustomConfig({loadCustomConfigFun:e.loadCustomConfigFun,saveCustomConfigFun:e.saveCustomConfigFun},d),h=f??s,x=j>Math.min(h,...l)||((m==null?void 0:m.hasNext)??!1),Y=e.viewMode,[se,me]=i.useState(Y??"table");i.useEffect(()=>{Y!==void 0&&me(Y)},[Y]);const we=Y??se,be=e.showCheckbox,[et,ee]=i.useState(be??!1);i.useEffect(()=>{be!==void 0&&ee(be)},[be]);const ke=be??et,je=e.columnResizable,[Te,Ne]=i.useState(je??!0);i.useEffect(()=>{je!==void 0&&Ne(je)},[je]);const Re=je??Te,O=e.stickyHeader,[te,H]=i.useState(O??!1);i.useEffect(()=>{O!==void 0&&H(O)},[O]);const ie=O??te,{exportOptions:Ee,exportDialogVisible:Ie,exporting:_e,exportFetched:Ve,exportTotal:Qe,exportTotalKnown:He,exportEtaSeconds:bt,exportPercent:jt,exportCancelledVisible:Ct,exportCancelledRows:ot,openExportDialog:g,closeExportDialog:_,doExport:D,cancelExport:re,keepPartialExport:De,discardPartialExport:We}=V.useExportExcel({props:{dataFun:e.dataFun,exportSelected:ke,exportorFunc:e.exportorFunc},tableName:(d==null?void 0:d.displayName)??"数据",columns:M,currentRows:k,selectedRows:v,total:j,exportPageSize:c,hasMorePage:x}),at=i.useCallback(y=>{var C,I;me(y),(I=(C=o.current).onUpdateViewMode)==null||I.call(C,y)},[]),ct=i.useCallback(y=>{var C,I;ee(y),(I=(C=o.current).onUpdateShowCheckbox)==null||I.call(C,y),y||W()},[W]),Gn=i.useCallback(y=>{var C,I;Ne(y),(I=(C=o.current).onUpdateColumnResizable)==null||I.call(C,y)},[]),Jn=i.useCallback(y=>{var C,I;H(y),(I=(C=o.current).onUpdateStickyHeader)==null||I.call(C,y)},[]),Ht=i.useRef(e.dataFun);Ht.current=e.dataFun;const St=i.useRef(s);St.current=s;const Wt=i.useRef(f);Wt.current=f;const Pe=i.useRef(p);Pe.current=p;const ut=i.useRef(e.onDataLoaded);ut.current=e.onDataLoaded;const wt=i.useRef(0),ye=i.useCallback(async y=>{var ae;const C=++wt.current,I=(y==null?void 0:y.limit)??Wt.current??St.current,oe=(y==null?void 0:y.page)??Pe.current;P(!0);try{const Ce=await Ht.current({limit:I,offset:(oe-1)*I},y==null?void 0:y.signal);if(C!==wt.current)return;z(Ce),(ae=ut.current)==null||ae.call(ut,Ce)}finally{C===wt.current&&P(!1)}},[P,z]),Xn=i.useCallback(y=>{Pe.current=y,L(y),ye({page:y})},[ye,L]),Nt=i.useCallback(y=>{E(y),Pe.current=1,L(1),ye({limit:y,page:1})},[ye,L,E]),qt=i.useRef(!1);i.useEffect(()=>{qt.current||(qt.current=!0,ye({page:1}))},[ye]);const[Rt,Zn]=i.useState(0),Kt=i.useRef(0);i.useEffect(()=>{Rt!==Kt.current&&(Kt.current=Rt,ye({page:1}))},[Rt,ye]);const Ut=i.useRef(void 0);i.useEffect(()=>{const y=Ut.current;Ut.current=f,!(y!==void 0||f===void 0)&&f!==St.current&&(Pe.current=1,L(1),ye({page:1}))},[f,ye,L]);const Gt=i.useRef(s);i.useEffect(()=>{Gt.current!==s&&(Gt.current=s,Nt(s))},[s,Nt]);const Jt=i.useRef(e.dataFun);i.useEffect(()=>{Jt.current!==e.dataFun&&(Jt.current=e.dataFun,Pe.current=1,L(1),ye({page:1}))},[e.dataFun,ye,L]);async function er(){await Promise.all([R(),K(),B()]),Pe.current=1,L(1),Zn(y=>y+1)}function tr(){ye()}const[dt,Xt]=i.useState(null);function nr(y,C,I){y.preventDefault(),y.stopPropagation();const oe=y.clientX,ae=tt=>Math.max(40,Math.round(I+tt-oe)),Ce=tt=>{Xt({propertyPath:C,width:ae(tt.clientX)})},yn=tt=>{window.removeEventListener("mousemove",Ce),window.removeEventListener("mouseup",yn),document.body.style.userSelect="";const mr=ae(tt.clientX);Xt(null),G(C,mr)};document.body.style.userSelect="none",window.addEventListener("mousemove",Ce),window.addEventListener("mouseup",yn)}const[qe,Et]=i.useState(null),rr=qe?V.visibleActions(Q,qe.row):[];function Zt(y,C){if(Q.length===0)return;y.preventDefault();const I=176,ae=V.visibleActions(Q,C).length*34+8;Et({x:Math.min(y.clientX,window.innerWidth-I-8),y:Math.min(y.clientY,window.innerHeight-ae-8),row:C})}function en(y,C){ue(y,C)}function sr(y){const C=qe==null?void 0:qe.row;Et(null),C&&y.execute(C,mt)}const[tn,ft]=i.useState([]),nn=i.useMemo(()=>((d==null?void 0:d.columns)??[]).map((y,C)=>({col:y,index:C})).filter(({col:y})=>y.showForDisplay??!0).sort((y,C)=>(y.col.displayOrder??y.index)-(C.col.displayOrder??C.index)).map(({col:y})=>y),[d]);function ir(){const y=le.columns;return nn.map((C,I)=>({col:C,config:y[C.propertyPath],index:I})).sort((C,I)=>{var oe,ae;return(((oe=C.config)==null?void 0:oe.order)??C.index)-(((ae=I.config)==null?void 0:ae.order)??I.index)}).map(({col:C,config:I})=>({propertyPath:C.propertyPath,displayName:C.displayName??C.propertyPath,visible:(I==null?void 0:I.visible)??!0,width:(I==null?void 0:I.width)??""}))}function lr(){ft(ir()),q()}function or(){ft(nn.map(y=>({propertyPath:y.propertyPath,displayName:y.displayName??y.propertyPath,visible:!0,width:""})))}function ar(y,C){ft(I=>{const oe=y+C;if(oe<0||oe>=I.length)return I;const ae=[...I],[Ce]=ae.splice(y,1);return Ce?(ae.splice(oe,0,Ce),ae):I})}async function cr(){var I,oe;const y={};tn.forEach((ae,Ce)=>{y[ae.propertyPath]={propertyPath:ae.propertyPath,visible:ae.visible,order:Ce,width:ae.width}});const C={pageSize:f,columns:y};await((oe=(I=o.current).saveCustomConfigFun)==null?void 0:oe.call(I,C)),Z(),o.current.loadCustomConfigFun&&await B()}const It=b||w||X||T,Oe=[];e.empty!=null&&Oe.push("empty"),e.footer!=null&&Oe.push("footer"),e.loading!=null&&Oe.push("loading"),e.card!=null&&Oe.push("card"),e.list!=null&&Oe.push("list"),e.selectionBar!=null&&Oe.push("selectionBar");const rn=i.useRef(d);rn.current=d;const sn=i.useRef(m);sn.current=m;const ln=i.useRef(we);ln.current=we;const on=i.useRef(ke);on.current=ke;const an=i.useRef(Re);an.current=Re;const cn=i.useRef(ie);cn.current=ie;const un=i.useRef(v);un.current=v;const dn=i.useRef(k);dn.current=k;const fn=i.useRef(Oe);fn.current=Oe;const mt={get meta(){return rn.current},get paged(){return sn.current},get currentPage(){return Pe.current},get viewMode(){return ln.current},get selectable(){return on.current},get columnResizable(){return an.current},get stickyHeader(){return cn.current},get slotNames(){return fn.current},get selectedRows(){return un.current},get rows(){return dn.current},reload:er,refresh:tr,setViewMode:at,setSelectable:ct,setColumnResizable:Gn,setStickyHeader:Jn,clearSelection:W,selectAllOnPage:ne,invertSelectionOnPage:U,openConfigDialog:lr,openExportDialog:g},Pt=i.useRef(mt);Pt.current=mt;const Ot=i.useRef(null);Ot.current===null&&(Ot.current=new Proxy({},{get:(y,C)=>Reflect.get(Pt.current,C),has:(y,C)=>Reflect.has(Pt.current,C)})),i.useImperativeHandle(r,()=>Ot.current,[]);const mn=M.map(y=>{const C=(dt==null?void 0:dt.propertyPath)===y.propertyPath?dt.width:Cr(y.width);return{key:y.propertyPath,dataIndex:y.propertyPath,title:y.displayName??y.propertyPath,width:C,ellipsis:!0,render:y.render?(I,oe)=>xn(y.render(oe,I)):I=>xn(I),onHeaderCell:()=>({className:`yk-table__col-header${Re?" yk-table__col-header--resizable":""}`,...Re?{onMouseDown:I=>{const oe=I.currentTarget.getBoundingClientRect();I.clientX<oe.right-8||nr(I,y.propertyPath,C??oe.width)}}:{}})}}),hn=kr({actions:Q,table:mt});hn&&mn.push(hn);const ur=ke?{selectedRowKeys:A,preserveSelectedRowKeys:!0,onChange:(y,C)=>$(C)}:void 0,dr={selectedRows:v,total:j,clearSelection:W,selectAllOnPage:ne,invertSelectionOnPage:U,pageSize:h};function fr(y,C){if(C!==h){Nt(C);return}Xn(y)}return t.jsxs("div",{className:"yk-table",children:[e.selectionBar?t.jsx("div",{className:"yk-table__selection-bar-slot",children:e.selectionBar(dr)}):null,t.jsxs("div",{className:"yk-table__view-area",children:[we==="table"?t.jsx("div",{className:`yk-table__table-wrap${ie?" yk-table__table-wrap--sticky-header":""}`,children:t.jsx(u.Table,{columns:mn,dataSource:k,rowKey:a,bordered:!0,pagination:!1,rowSelection:ur,locale:{emptyText:e.empty??t.jsx(u.Empty,{description:"暂无数据"})}})}):we==="card"?t.jsx(hr,{rows:k,rowKey:a,showCheckbox:ke,loading:It,hasActions:Q.length>0,isSelected:J,onCheck:en,onContextMenu:Zt,card:e.card,empty:e.empty}):t.jsx(pr,{rows:k,rowKey:a,showCheckbox:ke,loading:It,hasActions:Q.length>0,isSelected:J,onCheck:en,onContextMenu:Zt,list:e.list,empty:e.empty}),It?t.jsx("div",{className:"yk-table__loading-mask",children:e.loading??t.jsx("span",{className:"yk-table__loading-spinner","aria-label":"加载中"})}):null]}),x||e.footer!=null?t.jsxs("div",{className:"yk-table__footer",children:[t.jsx("div",{className:"yk-table__footer-extra",children:e.footer}),x?t.jsx(u.Pagination,{className:"yk-table__pagination",current:p,pageSize:h,total:j,pageSizeOptions:l,showSizeChanger:!0,showTotal:F?y=>`共 ${y} 条`:void 0,onChange:fr}):null]}):null,t.jsx(gr,{menu:qe,actions:rr,isEnabled:V.isEnabled,onClose:()=>Et(null),onSelect:sr}),t.jsx(yr,{open:N,drafts:tn,onCancel:Z,onSave:cr,onReset:or,onMove:ar,onDraftsChange:ft}),t.jsx(jn,{open:Ie,options:Ee,exporting:_e,fetched:Ve,total:Qe,totalKnown:He,percent:jt,etaSeconds:bt,cancelledVisible:Ct,cancelledRows:ot,onExport:y=>void D(y),onCancelExport:re,onKeepPartial:()=>void De(),onDiscardPartial:()=>void We(),onClose:_})]})});var Ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pe={},ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.AggInfoOf=ge.AggInfo=ge.AggItem=ge.AggType=void 0;ge.agg=Sr;var nt;(function(n){n.Sum="sum",n.Min="min",n.Max="max",n.Avg="avg",n.Count="count",n.DistinctCount="distinctcount"})(nt||(ge.AggType=nt={}));class Sn{constructor(e,r,s=null,l){this.path=e,this.type=r,this.name=s,this.filter=l}toString(){var e,r;const s=(r=(e=this.filter)===null||e===void 0?void 0:e.toString())!==null&&r!==void 0?r:"";return this.name?`${this.path}.${this.type}(${s}).as(${this.name})`:`${this.path}.${this.type}(${s})`}}ge.AggItem=Sn;class wn{constructor(...e){this.items=[],this.items.push(...e.filter(r=>r!==null))}append(e,r=nt.Sum,s=null,l){return this.items.push(new Sn(e,r,s,l)),this}toString(){return this.items.length===0?"":this.items.filter(e=>e!==null).map(e=>e.toString()).join(",")}}ge.AggInfo=wn;class Nn extends wn{append(e,r=nt.Sum,s=null,l){return super.append(e,r,s,l),this}}ge.AggInfoOf=Nn;function Sr(n,e=nt.Sum,r=null,s){return new Nn().append(n,e,r,s)}var fe={},de={},Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.Constant=void 0;Be.con=wr;class Rn{constructor(e){this.con=e}toString(){return JSON.stringify(this.con)}}Be.Constant=Rn;function wr(n){return new Rn(n)}var Ye={};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.Expression=void 0;Ye.exp=Nr;class En{constructor(e){this.exp=e}getExp(){return this.exp}toString(){return this.exp}}Ye.Expression=En;function Nr(n){return new En(n)}var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.key=Er;Ae.toExp=Ir;Ae.toValueExp=Pr;const xt=Ye,Rr=Be;function Er(n){return n.toString()}function Ir(n){return n instanceof xt.Expression?n:new xt.Expression(n)}function Pr(n){return n==null?null:n instanceof xt.Expression||n instanceof Rr.Constant?n:new xt.Expression(n)}Object.defineProperty(de,"__esModule",{value:!0});de.FilterInfoOf=de.empty=de.FilterInfo=de.CombinType=de.Operator=void 0;de.filter=Mr;de.emptyFilter=Fr;const rt=Be,Or=Ye,pn=Ae;var pt;(function(n){n.Equals="==",n.NotEquals="!=",n.GreaterThan=">",n.LessThanOrEqual="<=",n.LessThan="<",n.GreaterThanOrEqual=">=",n.Between="between",n.NotBetween="not_between",n.In="in",n.NotIn="not_in",n.StartsWith="startswith",n.NotStartsWith="not_startswith",n.EndsWith="endswith",n.NotEndsWith="not_endswith",n.Contains="contains",n.NotContains="not_contains"})(pt||(de.Operator=pt={}));var ce;(function(n){n[n.AndItems=1]="AndItems",n[n.OrItems=2]="OrItems",n[n.SingleItem=0]="SingleItem"})(ce||(de.CombinType=ce={}));class he{constructor(e,r,s,l=ce.SingleItem,a=[]){this.items=[],this.left=e,this.right=s,this.op=r,this.combinType=l,this.items=a}toString(){switch(this.combinType){case ce.AndItems:{const e=this.items.filter(r=>r&&!r.isEmpty());return e.length===1?`${e[0].toString()}`:e.map(r=>`(${r.toString()})`).join(` ${he.Operator_And} `)}case ce.OrItems:{const e=this.items.filter(r=>r&&!r.isEmpty());return e.length===1?`${e[0].toString()}`:e.map(r=>`(${r.toString()})`).join(` ${he.Operator_Or} `)}default:return this.isEmpty()?"":`${this.left} ${this.op} ${this.right}`}}andAlso(e){return this.combinType==ce.AndItems?(e.combinType==ce.AndItems?this.items=this.items.concat(e.items):this.items.push(e),this):he.createAnd(this,e)}orElse(e){return this.combinType==ce.OrItems?(e.combinType==ce.OrItems?this.items=this.items.concat(e.items):this.items.push(e),this):he.createOr(this,e)}static createOr(...e){return new he(null,null,null,ce.OrItems,e)}static createAnd(...e){return new he(null,null,null,ce.AndItems,e)}isEmpty(){return this.combinType==ce.SingleItem&&this.op==null}static fromSimpleObject(...e){return he.createAnd(...e.map(r=>{var s;return new he((0,Or.exp)(r.name),(s=r.op)!==null&&s!==void 0?s:pt.Equals,(0,rt.con)(r.value))}))}static fromSimpleDictionary(e){return he.fromSimpleObject(...Object.entries(e).map(([r,s])=>({name:r,value:s})))}}de.FilterInfo=he;he.Operator_And="and";he.Operator_Or="or";de.empty=new he((0,rt.con)(1),pt.Equals,(0,rt.con)(1));class Fe extends he{constructor(e,r,s,l=ce.SingleItem,a=[]){super((0,pn.toValueExp)(e),r,(0,pn.toValueExp)(s),l,a)}and(e,r,s){const l=new Fe(e,r,s);return this.combinType==ce.AndItems?(l.combinType==ce.AndItems?this.items=this.items.concat(l.items):this.items.push(l),this):new Fe(null,null,null,ce.AndItems,[this,l])}or(e,r,s){const l=new Fe(e,r,s);return this.combinType==ce.OrItems?(l.combinType==ce.OrItems?this.items=this.items.concat(l.items):this.items.push(l),this):new Fe(null,null,null,ce.OrItems,[this,l])}andIf(e,r,s,l){return e?this.and(r,s,l):this}orIf(e,r,s,l){return e?this.or(r,s,l):this}}de.FilterInfoOf=Fe;function Mr(n,e,r){return new Fe(n,e,r)}function Fr(){return new Fe((0,rt.con)(null),null,(0,rt.con)(null))}var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.queryConfig=void 0;Ze.queryConfig={defaultLimit:10,maxLimit:1e3};var st={};Object.defineProperty(st,"__esModule",{value:!0});st.DataOverflowError=void 0;class Yt extends Error{constructor(e){super(e),this.name="DataOverflowError",Object.setPrototypeOf(this,Yt.prototype)}}st.DataOverflowError=Yt;var xe=Ge&&Ge.__awaiter||function(n,e,r,s){function l(a){return a instanceof r?a:new r(function(c){c(a)})}return new(r||(r=Promise))(function(a,c){function o(k){try{m(s.next(k))}catch(b){c(b)}}function d(k){try{m(s.throw(k))}catch(b){c(b)}}function m(k){k.done?a(k.value):l(k.value).then(o,d)}m((s=s.apply(n,e||[])).next())})};Object.defineProperty(fe,"__esModule",{value:!0});fe.findBy=Pn;fe.findById=Ar;fe.count=Tr;fe.distinctCount=Dr;fe.distinctList=Lr;fe.asList=$r;fe.queryPage=zr;fe.loadAll=Yr;fe.aggValue=Vr;fe.aggProp=it;fe.sumProp=Qr;fe.maxProp=Hr;fe.minProp=Wr;fe.avgProp=qr;const vn=de,Br=Be,Je=ge,kt=Ze,In=st;function Pn(n,e,r,s){return xe(this,void 0,void 0,function*(){const l=yield n({limit:1,offset:0,filter:(0,vn.filter)(e,vn.Operator.Equals,(0,Br.con)(r)).toString(),countAll:!1},s);return l.items.length>0?l.items[0]:null})}function Ar(n,e,r){return xe(this,void 0,void 0,function*(){return Pn(n,"id",e,r)})}function Tr(n,e,r){return xe(this,void 0,void 0,function*(){var s;return(s=(yield n({limit:0,offset:0,filter:e==null?void 0:e.toString(),countAll:!0},r)).totalCount)!==null&&s!==void 0?s:0})}function Dr(n,e,r,s){return xe(this,void 0,void 0,function*(){var l;return(l=(yield n({limit:0,offset:0,filter:r==null?void 0:r.toString(),select:e.toString(),distinct:!0,countAll:!0},s)).totalCount)!==null&&l!==void 0?l:0})}function Lr(n,e,r){return xe(this,void 0,void 0,function*(){var s,l,a,c,o;const d=yield n({limit:(s=e.maxPageSize)!==null&&s!==void 0?s:kt.queryConfig.maxLimit,offset:0,filter:(l=e.filter)===null||l===void 0?void 0:l.toString(),select:e.select.toString(),orderBy:(a=e.orderBy)===null||a===void 0?void 0:a.toString(),distinct:!0,countAll:!1},r);if(d.hasNext&&(!((c=e.throwIfOverflow)!==null&&c!==void 0)||c))throw new In.DataOverflowError(`The result data of distinctList is lost. Total: ${(o=d.totalCount)!==null&&o!==void 0?o:0}, Max page size: ${d.limit}`);return d.items})}function $r(n,e,r){return xe(this,void 0,void 0,function*(){var s,l,a,c,o,d;const m=yield n({limit:(s=e==null?void 0:e.maxPageSize)!==null&&s!==void 0?s:kt.queryConfig.maxLimit,offset:0,filter:(l=e==null?void 0:e.filter)===null||l===void 0?void 0:l.toString(),select:(a=e==null?void 0:e.select)===null||a===void 0?void 0:a.toString(),orderBy:(c=e==null?void 0:e.orderBy)===null||c===void 0?void 0:c.toString(),countAll:!1},r);if(m.hasNext&&(!((o=e==null?void 0:e.throwIfOverflow)!==null&&o!==void 0)||o))throw new In.DataOverflowError(`The result data of asList is lost. Total: ${(d=m.totalCount)!==null&&d!==void 0?d:0}, Max page size: ${m.limit}`);return m.items})}function zr(n,e){var r,s,l,a,c,o;return n({limit:(r=e.limit)!==null&&r!==void 0?r:kt.queryConfig.defaultLimit,offset:(s=e.offset)!==null&&s!==void 0?s:0,filter:(l=e.filter)===null||l===void 0?void 0:l.toString(),select:(a=e.select)===null||a===void 0?void 0:a.toString(),orderBy:(c=e.orderBy)===null||c===void 0?void 0:c.toString(),agg:(o=e.agg)===null||o===void 0?void 0:o.toString(),distinct:e.distinct,countAll:e.countAll})}function Yr(n,e,r){return xe(this,void 0,void 0,function*(){var s,l,a,c,o;let d=[],m=0;const k={limit:(s=e==null?void 0:e.maxPageSize)!==null&&s!==void 0?s:kt.queryConfig.maxLimit,filter:(l=e==null?void 0:e.filter)===null||l===void 0?void 0:l.toString(),select:(a=e==null?void 0:e.select)===null||a===void 0?void 0:a.toString(),orderBy:(c=e==null?void 0:e.orderBy)===null||c===void 0?void 0:c.toString(),distinct:(o=e==null?void 0:e.distinct)!==null&&o!==void 0?o:!1,countAll:!1};for(;!(r!=null&&r.aborted);){const b=yield n(Object.assign(Object.assign({},k),{offset:m}),r);if(d=d.concat(b.items),m+=k.limit,b.items.length==0||!b.hasNext||r!=null&&r.aborted)break}return d})}function Vr(n,e,r,s){return xe(this,void 0,void 0,function*(){return(yield n({limit:0,offset:0,filter:r==null?void 0:r.toString(),agg:e.toString(),countAll:!1},s)).aggs})}function it(n,e){return xe(this,arguments,void 0,function*(r,s,l=Je.AggType.Sum,a,c){var o;const d="__tg0",m=yield r({limit:0,offset:0,filter:a==null?void 0:a.toString(),agg:(0,Je.agg)(s,l,d,a).toString(),countAll:!1},c);return Number((o=m.aggs)===null||o===void 0?void 0:o[d])})}function Qr(n,e,r,s){return xe(this,void 0,void 0,function*(){return it(n,e,Je.AggType.Sum,r,s)})}function Hr(n,e,r,s){return xe(this,void 0,void 0,function*(){return it(n,e,Je.AggType.Max,r,s)})}function Wr(n,e,r,s){return xe(this,void 0,void 0,function*(){return it(n,e,Je.AggType.Min,r,s)})}function qr(n,e,r,s){return xe(this,void 0,void 0,function*(){return it(n,e,Je.AggType.Avg,r,s)})}var _t={};Object.defineProperty(_t,"__esModule",{value:!0});_t.LimitInfo=void 0;class Kr{}_t.LimitInfo=Kr;var ve={};Object.defineProperty(ve,"__esModule",{value:!0});ve.OrderByInfoOf=ve.OrderByInfo=ve.OrderByItem=ve.OrderByType=void 0;ve.orderby=Ur;const Tt=Ae;var Xe;(function(n){n.Asc="asc()",n.Desc="desc()"})(Xe||(ve.OrderByType=Xe={}));class On{constructor(e,r){this.path=e,this.type=r}toString(){return`${this.path}.${this.type.toString()}`}}ve.OrderByItem=On;class Mn{constructor(...e){this.items=[],this.items.push(...e.filter(r=>r!==null))}toString(){return this.items.length===0?"":this.items.filter(e=>e!==null).map(e=>e.toString()).join(",")}add(e,r=Xe.Asc){return this.items.push(new On(e,r)),this}}ve.OrderByInfo=Mn;class Fn extends Mn{then(e){return this.add((0,Tt.toExp)(e),Xe.Asc),this}thenDesc(e){return this.add((0,Tt.toExp)(e),Xe.Desc),this}}ve.OrderByInfoOf=Fn;function Ur(n,e=Xe.Asc){const r=new Fn;return r.add((0,Tt.toExp)(n),e),r}var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});var ze={},Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.SelectInfoOf=Se.SelectInfo=Se.SelectItem=void 0;Se.select=Gr;class Dt{constructor(e,r=!1){this.name=e,this.exclude=r}toString(){return this.exclude?`-${this.name}`:this.name}}Se.SelectItem=Dt;class An{constructor(...e){this.items=[],this.items.push(...e.filter(r=>r!==null))}toString(){return this.items.length===0?"":this.items.filter(e=>e!==null).map(e=>e.toString()).join(",")}appendItems(...e){return this.items?this.items=this.items.concat(e):this.items=e,this}}Se.SelectInfo=An;class Tn extends An{include(...e){return this.appendItems(...e.map(r=>new Dt(r.toString()))),this}exclude(...e){return this.appendItems(...e.map(r=>new Dt(r.toString(),!0))),this}}Se.SelectInfoOf=Tn;function Gr(...n){return new Tn().include(...n)}Object.defineProperty(ze,"__esModule",{value:!0});ze.QueryBuilderOf=ze.QueryBuilder=void 0;ze.query=Xr;const Mt=ge,Ft=de,Me=ve,Ke=Se,Le=Ae,Jr=Ze;class Dn{constructor(){this._limit=Jr.queryConfig.defaultLimit,this._offset=0}build(){const e={limit:this._limit,offset:this._offset};return this._filterInfo&&(e.filter=this._filterInfo.toString()),this._orderByInfo&&(e.orderBy=this._orderByInfo.toString()),this._selectInfo&&(e.select=this._selectInfo.toString()),this._aggInfo&&(e.agg=this._aggInfo.toString()),e}withAgg(e){return this._aggInfo=e,this}withFilter(e){return this._filterInfo=e,this}withOrderBy(e){return this._orderByInfo=e,this}withSelect(e){return this._selectInfo=e,this}offset(e){return this._offset=e,this}limit(e){return this._limit=e,this}}ze.QueryBuilder=Dn;class Ln extends Dn{where(e,r=Ft.Operator.Equals,s){return this._filterInfo?this._filterInfo=this._filterInfo.andAlso(new Ft.FilterInfo((0,Le.toValueExp)(e),r,(0,Le.toValueExp)(s))):this._filterInfo=new Ft.FilterInfo((0,Le.toValueExp)(e),r,(0,Le.toValueExp)(s)),this}orderby(e,r=Me.OrderByType.Asc){return this._orderByInfo=new Me.OrderByInfo(new Me.OrderByItem((0,Le.toExp)(e),r)),this}orderbyDesc(e){return this.orderby(e,Me.OrderByType.Desc)}thenby(e,r=Me.OrderByType.Asc){return this._orderByInfo?this._orderByInfo.add((0,Le.toExp)(e),r):this._orderByInfo=new Me.OrderByInfo(new Me.OrderByItem((0,Le.toExp)(e),r)),this}thenbyDesc(e){return this.thenby(e,Me.OrderByType.Desc)}agg(e,r=Mt.AggType.Sum,s=null){return this._aggInfo?this._aggInfo.append(e,r,s):this._aggInfo=new Mt.AggInfo(new Mt.AggItem(e,r,s)),this}include(...e){return this._selectInfo?this._selectInfo.appendItems(...e.map(r=>new Ke.SelectItem(r.toString()))):this._selectInfo=new Ke.SelectInfo(...e.map(r=>new Ke.SelectItem(r.toString()))),this}exclude(...e){return this._selectInfo?this._selectInfo.appendItems(...e.map(r=>new Ke.SelectItem(r.toString(),!0))):this._selectInfo=new Ke.SelectInfo(...e.map(r=>new Ke.SelectItem(r.toString(),!0))),this}}ze.QueryBuilderOf=Ln;function Xr(){return new Ln}(function(n){var e=Ge&&Ge.__createBinding||(Object.create?function(s,l,a,c){c===void 0&&(c=a);var o=Object.getOwnPropertyDescriptor(l,a);(!o||("get"in o?!l.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(s,c,o)}:function(s,l,a,c){c===void 0&&(c=a),s[c]=l[a]}),r=Ge&&Ge.__exportStar||function(s,l){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(l,a)&&e(l,s,a)};Object.defineProperty(n,"__esModule",{value:!0}),r(ge,n),r(fe,n),r(Be,n),r(Ze,n),r(Ye,n),r(de,n),r(_t,n),r(ve,n),r(Bn,n),r(ze,n),r(Se,n),r(Ae,n),r(st,n)})(pe);const Zr=i.createContext(null),es=[{label:"是",value:!0},{label:"否",value:!1}];function ht(n){const e=$e();return[e.subtract(n,"day"),e]}function $n(n){const[e,r]=i.useState(7),s=n.valueFormat??"YYYY-MM-DD",l=n.op===S.Operator.Between||n.op===S.Operator.NotBetween,a=n.op===S.Operator.In||n.op===S.Operator.NotIn,c=n.value,o=typeof c=="string"?c:"",d=typeof c=="number"?c:void 0,m=typeof c=="boolean"?c:void 0,k=typeof c=="string"||typeof c=="number"||typeof c=="boolean"?c:void 0,b=Array.isArray(c)?c:[],w=Array.isArray(c)&&c.length===2&&typeof c[0]=="string"&&typeof c[1]=="string"?[$e(c[0]),$e(c[1])]:null,p=Array.isArray(c)&&typeof c[0]=="number"?c[0]:void 0,j=Array.isArray(c)&&typeof c[1]=="number"?c[1]:void 0,F=(n.options??[]).map(v=>({label:v.label,value:v.value})),R=v=>{var A;return(A=n.onChange)==null?void 0:A.call(n,v)},z=()=>{const v=e;if(!v||v<1)return;const[A,$]=ht(v);R([A.format(s),$.format(s)])};let P;n.fieldType==="string"&&a?P=t.jsx(u.Select,{mode:"tags",value:b,onChange:v=>R(v),tokenSeparators:[",",","],placeholder:"输入后回车添加",style:{width:"100%"}}):n.fieldType==="string"?P=t.jsx(u.Input,{value:o,onChange:v=>R(v.target.value),placeholder:"请输入",allowClear:!0}):n.fieldType==="number"&&l?P=t.jsxs(t.Fragment,{children:[t.jsx(u.InputNumber,{className:"yk-advanced-value-editor__num",value:p,onChange:v=>R([v??null,j??null]),placeholder:"最小值",controls:!1}),t.jsx("span",{className:"yk-advanced-value-editor__sep",children:"~"}),t.jsx(u.InputNumber,{className:"yk-advanced-value-editor__num",value:j,onChange:v=>R([p??null,v??null]),placeholder:"最大值",controls:!1})]}):n.fieldType==="number"?P=t.jsx(u.InputNumber,{value:d,onChange:v=>R(v??null),placeholder:"请输入数字",controls:!1,style:{width:"100%"}}):n.fieldType==="date"&&l?P=t.jsxs(t.Fragment,{children:[t.jsx(u.DatePicker.RangePicker,{className:"yk-advanced-value-editor__daterange-picker",value:w,format:s,placeholder:["开始日期","结束日期"],presets:[{label:"最近 7 天",value:()=>ht(7)},{label:"最近 30 天",value:()=>ht(30)},{label:"最近 90 天",value:()=>ht(90)}],onChange:(v,A)=>{R(v?[A[0],A[1]]:null)}}),t.jsx(u.Popover,{trigger:"click",placement:"bottom",content:t.jsxs("div",{className:"yk-advanced-value-editor__recent-pop",children:[t.jsx("span",{children:"最近"}),t.jsx(u.InputNumber,{className:"yk-advanced-value-editor__recent-input",value:e,onChange:v=>r(typeof v=="number"?v:1),min:1,controls:!1}),t.jsx("span",{children:"天"}),t.jsx(u.Button,{type:"primary",size:"small",onClick:z,children:"应用"})]}),children:t.jsx(u.Button,{className:"yk-advanced-value-editor__recent-trigger",style:{flex:"0 0 auto"},children:"最近 N 天"})})]}):n.fieldType==="date"?P=t.jsx(u.DatePicker,{value:typeof c=="string"?$e(c):null,format:s,onChange:(v,A)=>R(A||null),placeholder:"选择日期",allowClear:!0}):n.fieldType==="boolean"?P=t.jsx(u.Select,{value:m,options:es.map(v=>({label:v.label,value:v.value})),onChange:v=>R(v),placeholder:"请选择",allowClear:!0}):n.fieldType==="enum"&&a?P=t.jsx(u.Select,{mode:"multiple",value:b,options:F,onChange:v=>R(v),placeholder:"请选择",allowClear:!0,loading:n.optionsLoading}):P=t.jsx(u.Select,{value:k,options:F,onChange:v=>R(v??null),placeholder:"请选择",allowClear:!0,loading:n.optionsLoading});const L=["yk-advanced-value-editor",l?"yk-advanced-value-editor--range":"",n.fieldType==="date"&&l?"yk-advanced-value-editor--daterange":"",n.className??""].filter(Boolean).join(" ");return t.jsx("div",{className:L,children:P})}function Vt(n){const e=i.useContext(Zr);if(!e)return null;const{group:r,level:s=0}=n,l=o=>{(o==="and"||o==="or")&&e.api.setGroupCombinator(r.id,o)},a=o=>e.columns.find(d=>d.propertyPath===o),c=o=>{var d;return((d=a(o))==null?void 0:d.displayFormat)??"YYYY-MM-DD"};return t.jsxs("div",{className:`yk-adv-group level-${s}${s===0?" is-root":""}`,children:[t.jsxs("div",{className:"yk-adv-group__header",children:[t.jsx("span",{className:"yk-adv-group__comb-label",children:"满足"}),t.jsxs(u.Radio.Group,{size:"small",value:r.combinator,onChange:o=>l(o.target.value),children:[t.jsx(u.Radio.Button,{value:"and",children:"全部"}),t.jsx(u.Radio.Button,{value:"or",children:"任一"})]}),t.jsx("span",{className:"yk-adv-group__comb-label",children:"条件"}),t.jsxs("span",{className:"yk-adv-group__actions",children:[t.jsx(u.Button,{type:"link",onClick:()=>e.api.addLeaf(r.id),children:"+ 条件"}),t.jsx(u.Button,{type:"link",onClick:()=>e.api.addNestedGroup(r.id),children:"+ 嵌套组"}),s>0&&t.jsx(u.Button,{type:"link",danger:!0,onClick:()=>e.api.removeNode(r.id),children:"删除组"})]})]}),t.jsxs("div",{className:"yk-adv-group__children",children:[r.children.map(o=>{if(S.isConditionGroup(o))return t.jsx("div",{className:"yk-adv-group__nested",children:t.jsx(Vt,{group:o,level:s+1})},o.id);const d=o;return t.jsxs("div",{className:"yk-adv-group__row",children:[t.jsx(u.Select,{className:"yk-adv-group__field",value:d.propertyPath||void 0,options:e.columns.map(m=>({label:m.displayName??m.propertyPath,value:m.propertyPath})),placeholder:"选择字段",showSearch:!0,optionFilterProp:"label",onChange:m=>e.api.changeField(d.id,m)}),t.jsx(u.Select,{className:"yk-adv-group__op",value:d.op,options:e.api.operatorsOf(d.propertyPath).map(m=>({label:S.OPERATOR_LABELS[m]??String(m),value:m})),placeholder:"操作符",showSearch:!0,optionFilterProp:"label",onChange:m=>e.api.changeOperator(d.id,m)}),!S.isNullOperator(d.op)&&t.jsx($n,{className:["yk-adv-group__value",e.api.isConditionEmpty(d)?"is-invalid":""].filter(Boolean).join(" "),fieldType:e.api.fieldTypeOf(d.propertyPath),op:d.op,value:d.value,options:e.optionsMap[d.propertyPath]??[],optionsLoading:e.loadingMap[d.propertyPath]===!0,valueFormat:c(d.propertyPath),onChange:m=>e.updateValue(d.id,m)}),t.jsx(u.Button,{className:"yk-adv-group__remove",type:"link",danger:!0,onClick:()=>e.api.removeNode(d.id),children:"删除"})]},d.id)}),r.children.length===0&&t.jsx("div",{className:"yk-adv-group__empty",children:"暂无条件,点击「+ 条件」或「+ 嵌套组」"})]})]})}const zn=i.forwardRef(function(e,r){const s=e.showSearch??!0,l=e.showReset??!0,a=e.searchButtonText??"查询",c=e.resetButtonText??"重置",o=e.showSaveQuery??!0,d=V.useAdvancedFilter({columns:e.columns,optionSources:e.optionSources}),{rootGroup:m,fieldTypeOf:k,filter:b,reset:w}=d,[p,j]=i.useState({}),[F,R]=i.useState({}),z=i.useRef({}),P=i.useRef({}),L=x=>{var se;const Y=(se=e.optionSources)==null?void 0:se[x];Y&&(z.current[x]||P.current[x]||(P.current={...P.current,[x]:!0},R(P.current),Y().then(me=>{z.current={...z.current,[x]:me},j(z.current)}).finally(()=>{P.current={...P.current,[x]:!1},R(P.current)})))},v=x=>{const Y=new Set,se=me=>{S.isConditionGroup(me)?me.children.forEach(se):k(me.propertyPath)==="enum"&&Y.add(me.propertyPath)};return x.children.forEach(se),[...Y]};i.useEffect(()=>{for(const x of v(m))L(x)},[m,k,e.optionSources]);const[A,$]=i.useState([]),J=e.savedQueries??A,ue=x=>{var Y;$(x),(Y=e.onUpdateSavedQueries)==null||Y.call(e,x)},[W,ne]=i.useState(!1),[U,Q]=i.useState(""),[X,K]=i.useState(""),le=i.useRef(0),T=()=>{const x=Y=>Y.children.some(se=>S.isConditionGroup(se)?x(se):d.isConditionEmpty(se));return x(m)},f=()=>{Q(""),K(""),ne(!0)},N=()=>{const x=U.trim();if(!x)return;T()&&u.message.warning("当前存在未填值的条件行(标红),保存的预设可能不完整");const Y=JSON.parse(JSON.stringify(m)),se={id:`sq-${++le.current}`,name:x,description:X.trim(),group:Y,filterInfo:b};ue([...J,se]),ne(!1)},M=i.useRef(!1),[B,E]=i.useState(0),G=x=>{const Y=JSON.parse(JSON.stringify(x.group));Object.assign(m,Y),d.setGroupCombinator(m.id,m.combinator),M.current=!0,E(se=>se+1)};i.useEffect(()=>{var x;M.current&&(M.current=!1,(x=e.onSearch)==null||x.call(e,b))},[B,b]);const q=x=>{ue(J.filter(Y=>Y.id!==x))},Z=()=>{var x;return(x=e.onSearch)==null?void 0:x.call(e,b)},h=()=>{var x;w(),(x=e.onReset)==null||x.call(e)};return i.useImperativeHandle(r,()=>({get filter(){return b},reset:h,openSaveDialog:f,applySavedQuery:G,removeSavedQuery:q,get savedQueries(){return J}}),[b,J,m]),e.columns,t.jsxs("div",{className:"yk-advanced-filter",onKeyDown:x=>{x.key==="Enter"&&Z()},children:[t.jsx(Vt,{group:m,level:0}),(s||l||o)&&t.jsxs("div",{className:"yk-advanced-filter__actions",children:[s&&t.jsx(u.Button,{type:"primary",onClick:Z,children:a}),l&&t.jsx(u.Button,{onClick:h,children:c}),o&&t.jsx(u.Button,{onClick:f,children:"保存"})]}),t.jsxs(u.Modal,{open:W,title:"保存查询",width:440,onCancel:()=>ne(!1),onOk:N,okText:"确定",cancelText:"取消",okButtonProps:{disabled:!U.trim()},children:[t.jsxs("div",{className:"yk-advanced-filter__form-item",children:[t.jsx("label",{className:"yk-advanced-filter__form-label",children:"名称"}),t.jsx(u.Input,{value:U,onChange:x=>Q(x.target.value),placeholder:"请输入查询名称",maxLength:50,showCount:!0,onPressEnter:N})]}),t.jsxs("div",{className:"yk-advanced-filter__form-item",children:[t.jsx("label",{className:"yk-advanced-filter__form-label",children:"描述"}),t.jsx(u.Input.TextArea,{value:X,onChange:x=>K(x.target.value),rows:2,placeholder:"可选,描述此查询的用途(hover 标签时显示)",maxLength:200,showCount:!0})]})]})]})}),Yn=i.forwardRef(function(e,r){const s=V.useFilterPanel(),l=i.useRef(s);l.current=s;const a=i.useMemo(()=>({get filter(){return l.current.filter},reset:()=>l.current.reset(),register:s.register,notify:s.notify}),[s.register,s.notify]),c=i.useMemo(()=>{const o=[];e.extraFilter&&o.push(e.extraFilter);const d=s.filter;return d&&!d.isEmpty()&&o.push(d),o.length===0?S.emptyFilter():o.length===1?o[0]:S.FilterInfo.createAnd(...o)},[e.extraFilter,s.filter]);return i.useImperativeHandle(r,()=>({filter:c,reset:()=>s.reset()}),[c,s]),t.jsx(V.FilterPanelContext.Provider,{value:a,children:e.children})});function ts(n,e){const r=new Map;for(const s of n)r.set(s.propertyPath,S.inferColumnFieldType(s,(e==null?void 0:e[s.propertyPath])!==void 0));return s=>r.get(s)??"string"}function ns(n,e){if(S.isNullOperator(n.op))return!1;const r=e(n.propertyPath),s=n.value;return S.isRangeOperator(n.op)?!Array.isArray(s)||s.length!==2?!0:s[0]===null||s[0]===void 0||s[0]===""||s[1]===null||s[1]===void 0||s[1]==="":S.isMultiValueOperator(n.op)?!Array.isArray(s)||s.length===0:r==="boolean"||r==="number"||r==="date"?s==null||s==="":s==null||typeof s=="string"&&s.trim()===""}function rs(n,e){if(ns(n,e))return null;if(n.op==="is_null"){const r=e(n.propertyPath);return r==="string"?S.FilterInfo.createOr(S.filter(n.propertyPath,S.Operator.Equals,pe.con(null)),S.filter(n.propertyPath,S.Operator.Equals,pe.con(""))):r==="array"?S.FilterInfo.createOr(S.filter(n.propertyPath,S.Operator.Equals,pe.con(null)),S.filter(`${n.propertyPath}.count`,S.Operator.Equals,pe.con(0))):S.filter(n.propertyPath,S.Operator.Equals,pe.con(null))}if(n.op==="is_not_null"){const r=e(n.propertyPath);return r==="string"?S.FilterInfo.createAnd(S.filter(n.propertyPath,S.Operator.NotEquals,pe.con(null)),S.filter(n.propertyPath,S.Operator.NotEquals,pe.con(""))):r==="array"?S.FilterInfo.createAnd(S.filter(n.propertyPath,S.Operator.NotEquals,pe.con(null)),S.filter(`${n.propertyPath}.count`,S.Operator.GreaterThan,pe.con(0))):S.filter(n.propertyPath,S.Operator.NotEquals,pe.con(null))}return S.filter(n.propertyPath,n.op,pe.con(n.value))}function Vn(n,e){if(S.isConditionGroup(n)){const r=n.children.map(s=>Vn(s,e)).filter(s=>s!==null);return r.length===0?null:r.length===1?r[0]:n.combinator==="or"?S.FilterInfo.createOr(...r):S.FilterInfo.createAnd(...r)}return rs(n,e)}function ss(n,e,r){const s=ts(e,r);return Vn(n,s)??S.emptyFilter()}const Qn=i.forwardRef(function(e,r){const s=e.showSearch??!0,l=e.showReset??!0,a=e.searchButtonText??"查询",c=e.resetButtonText??"重置",o=e.enableAdvancedFilter??!1,d=e.advancedColumns??[],m=e.showQuickQuery??!1,k=e.singleLine??!1,b=i.useRef(null),w=i.useRef(null),[p,j]=i.useState("simple"),[F,R]=i.useState(!0),[z,P]=i.useState(0),L=i.useRef(null),[v,A]=i.useState([]),$=e.quickQueries??v,J=()=>{var f,N;return p==="advanced"?((f=w.current)==null?void 0:f.filter)??S.emptyFilter():((N=b.current)==null?void 0:N.filter)??S.emptyFilter()},ue=()=>{var f;return(f=e.onSearch)==null?void 0:f.call(e,J())},W=()=>{var f,N,M;p==="advanced"?(f=w.current)==null||f.reset():(N=b.current)==null||N.reset(),(M=e.onReset)==null||M.call(e)};i.useImperativeHandle(r,()=>({get filter(){return J()},get mode(){return p},reset:W}),[p]);const ne=f=>{var N;A(f),(N=e.onUpdateQuickQueries)==null||N.call(e,f)},U=async f=>{const N=new Set($.map(B=>B.id)),M=f.filter(B=>!N.has(B.id));if(e.saveQuickQueryFun&&M.length>0){const B=[];for(const G of M)try{const q=await e.saveQuickQueryFun(G);B.push(q??G)}catch{u.message.error(`保存快速查询「${G.name}」失败`),B.push(G)}let E=f;if(B.some((G,q)=>G!==M[q])){const G=new Map(M.map((q,Z)=>[q.id,B[Z]??q]));E=f.map(q=>G.get(q.id)??q)}ne(E)}else ne(f)};i.useEffect(()=>{if(!e.loadQuickQueryFun)return;let f=!1;return e.loadQuickQueryFun().then(N=>{var B;if(f)return;const M=N.map(E=>({...E,filterInfo:E.filterInfo??ss(E.group,d,e.advancedOptionSources)}));A(M),(B=e.onUpdateQuickQueries)==null||B.call(e,M)}).catch(()=>{f||u.message.error("加载快速查询失败")}),()=>{f=!0}},[]);const Q=f=>{var N,M;p==="advanced"?(N=w.current)==null||N.applySavedQuery(f):(M=e.onSearch)==null||M.call(e,f.filterInfo)},X=f=>{const N=$.find(B=>B.id===f),M=(N==null?void 0:N.name)??"该查询";u.Modal.confirm({title:"删除确认",content:`确定要删除快速查询「${M}」吗?`,okText:"删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:()=>{U($.filter(B=>B.id!==f))}})},K=()=>{const f=L.current;if(!f)return;for(const Z of Array.from(f.children))Z.style.display="";if(!k||!F){P(0),f.style.maxWidth="";return}const N=f.nextElementSibling,M=N?N.offsetWidth:0,B=16;f.style.maxWidth=`calc(100% - ${M+B}px)`;const E=f.clientWidth;let G=0,q=0;for(const Z of Array.from(f.children)){const h=Z,x=h.offsetWidth;G>0&&G+x+B>E?(h.style.display="none",q++):G+=x+B}P(q)};i.useEffect(()=>{K();const f=L.current;if(!f)return;const N=new ResizeObserver(()=>K());return N.observe(f),()=>N.disconnect()},[k,F,p]);const le=()=>R(f=>!f),T=F?t.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"6 9 12 15 18 9"}),t.jsx("polyline",{points:"6 14 12 20 18 14"})]}):t.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"18 15 12 9 6 15"}),t.jsx("polyline",{points:"18 10 12 4 6 10"})]});return t.jsx("div",{className:["yk-filter-panel",k?"is-single-line":"",k&&F?"is-collapsed":""].filter(Boolean).join(" "),onKeyDown:f=>{f.key==="Enter"&&p==="simple"&&ue()},children:p==="simple"?t.jsxs(t.Fragment,{children:[k&&t.jsx(u.Button,{type:"text",className:"yk-filter-panel__toggle","aria-label":F?"展开更多条件":"折叠",title:F?z?`展开(${z} 个条件被隐藏)`:"展开":"折叠",onClick:le,children:T}),t.jsx("div",{className:"yk-filter-panel__items",ref:L,children:t.jsx(Yn,{ref:b,children:e.children})}),(s||l||o)&&t.jsxs("div",{className:"yk-filter-panel__actions",children:[s&&t.jsx(u.Button,{type:"primary",onClick:ue,children:a}),l&&t.jsx(u.Button,{onClick:W,children:c}),o&&!(k&&F)&&t.jsx(u.Button,{type:"link",onClick:()=>j("advanced"),children:"高级查询"})]}),m&&$.length>0&&t.jsxs("div",{className:"yk-filter-panel__saved",children:[t.jsx("span",{className:"yk-filter-panel__saved-label",children:"快速查询:"}),$.map(f=>t.jsx(u.Tooltip,{title:f.description||void 0,children:t.jsx(u.Button,{size:"small",onClick:()=>Q(f),children:f.name})},f.id))]})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"yk-filter-panel__mode-bar",children:t.jsx(u.Button,{type:"link",onClick:()=>j("simple"),children:"← 简单查询"})}),t.jsx(zn,{ref:w,columns:d,optionSources:e.advancedOptionSources,savedQueries:$,onSearch:f=>{var N;return(N=e.onSearch)==null?void 0:N.call(e,f)},onReset:()=>{var f;return(f=e.onReset)==null?void 0:f.call(e)},onUpdateSavedQueries:U}),$.length>0&&t.jsxs("div",{className:"yk-filter-panel__saved",children:[t.jsx("span",{className:"yk-filter-panel__saved-label",children:"已存查询:"}),$.map(f=>t.jsx(u.Tooltip,{title:f.description||void 0,children:t.jsx(u.Tag,{className:"yk-filter-panel__saved-tag",closable:!0,onClick:()=>Q(f),onClose:()=>X(f.id),children:f.name})},f.id))]})]})})});function is({count:n,onSelectAll:e,onInvert:r,onClear:s}){return n<=0?null:t.jsxs("div",{className:"yk-table__selection-bar",children:[t.jsxs("span",{className:"yk-table__selection-bar__count",children:["已选 ",n," 项"]}),t.jsx("span",{className:"yk-table__selection-bar__sep",children:"|"}),t.jsx(u.Button,{type:"link",className:"yk-table__selection-bar__btn",onClick:e,children:"全选"}),t.jsx(u.Button,{type:"link",className:"yk-table__selection-bar__btn",onClick:r,children:"反选"}),t.jsx("span",{className:"yk-table__selection-bar__sep",children:"|"}),t.jsx(u.Button,{type:"link",className:"yk-table__selection-bar__btn",onClick:s,children:"清空"})]})}function ls(){return t.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("circle",{cx:"9",cy:"6",r:"2.4",fill:"#fff"}),t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t.jsx("circle",{cx:"15",cy:"12",r:"2.4",fill:"#fff"}),t.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"}),t.jsx("circle",{cx:"9",cy:"18",r:"2.4",fill:"#fff"})]})}function os(){return t.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"yk-table-action-menu-button__icon","aria-hidden":"true",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("polyline",{points:"1 20 1 14 7 14"}),t.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function as(){return t.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"yk-table-action-menu-button__icon","aria-hidden":"true",children:[t.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t.jsx("polyline",{points:"7 10 12 15 17 10"}),t.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function cs(){return t.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"yk-table-action-menu-button__icon","aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function Ue({checked:n}){return t.jsx("span",{className:"yk-table-action-menu-button__check",children:n?"✓":""})}const Qt=i.forwardRef(function({table:e,trigger:r,className:s},l){const[,a]=i.useReducer(d=>d+1,0);function c(d){switch(d){case"refresh":e.refresh();break;case"config":e.openConfigDialog();break;case"export":e.openExportDialog();break;case"view-table":e.setViewMode("table");break;case"view-card":e.setViewMode("card");break;case"view-list":e.setViewMode("list");break;case"toggle-checkbox":e.setSelectable(!e.selectable);break;case"toggle-column-resize":e.setColumnResizable(!e.columnResizable);break;case"toggle-sticky-header":e.setStickyHeader(!e.stickyHeader);break}}const o=[{key:"refresh",label:t.jsxs(t.Fragment,{children:[t.jsx(os,{}),"刷新"]})},{key:"export",label:t.jsxs(t.Fragment,{children:[t.jsx(as,{}),"导出 Excel"]})},{key:"config",label:t.jsxs(t.Fragment,{children:[t.jsx(cs,{}),"列设置"]})},{type:"divider"},{key:"view-table",label:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{checked:e.viewMode==="table"}),"表格视图"]})},...e.slotNames.includes("card")?[{key:"view-card",label:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{checked:e.viewMode==="card"}),"卡片视图"]})}]:[],...e.slotNames.includes("list")?[{key:"view-list",label:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{checked:e.viewMode==="list"}),"列表视图"]})}]:[],{type:"divider"},{key:"toggle-checkbox",label:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{checked:e.selectable}),"选择行"]})},{key:"toggle-column-resize",label:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{checked:e.columnResizable}),"列宽拖动"]})},{key:"toggle-sticky-header",label:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{checked:e.stickyHeader}),"锁定表头"]})}];return t.jsx(u.Dropdown,{trigger:["click"],placement:"bottomRight",onOpenChange:d=>{d&&a()},menu:{items:o,onClick:({key:d})=>c(d)},children:r?t.jsx("span",{className:"yk-table-action-menu-button__trigger",children:r}):t.jsx(u.Button,{ref:l,className:`yk-table-action-menu-button__btn${s?` ${s}`:""}`,title:"表格操作","aria-label":"表格操作",children:t.jsx(ls,{})})})});Qt.displayName="YsTableActionMenuButton";function Hn({actions:n,table:e=null,showActionMenuButton:r=!0,children:s}){const[l,a]=i.useState(null);async function c(o){if(!(!e||l!==null)){a(o.name);try{await o.execute(e)}finally{a(null)}}}return t.jsxs("div",{className:"yk-command-bar",children:[t.jsxs("div",{className:"yk-command-bar__actions",children:[n.map(o=>t.jsx(u.Button,{...zt(o.type,o.plain),icon:vt(o.icon),loading:l===o.name,disabled:l!==null&&l!==o.name,onClick:()=>void c(o),children:o.desc},o.name)),e&&t.jsx(is,{count:e.selectedRows.length,onSelectAll:()=>e.selectAllOnPage(),onInvert:()=>e.invertSelectionOnPage(),onClear:()=>e.clearSelection()}),s]}),r&&e&&t.jsx(Qt,{table:e,className:"yk-command-bar__menu"})]})}const us=[10,20,50,100],ds=[],fs=[],ms=[],hs=[],ys=[];function kn(n){if(n!=null)return typeof n=="function"?n:()=>n}function Bt(n){return typeof n=="function"?n():n}const Wn=i.forwardRef(function(e,r){const{metaFun:s,dataFun:l,rowActionsFunc:a,pageSize:c=20,pageSizes:o=us,showCheckbox:d=!1,columnResizable:m=!0,stickyHeader:k=!1,loadCustomConfigFun:b,saveCustomConfigFun:w,exportPageSize:p=1e3,exportorFunc:j,rowKey:F="id",viewMode:R="table",actions:z=fs,showActionMenuButton:P=!0,showSearch:L=!0,showReset:v=!0,searchButtonText:A="查询",resetButtonText:$="重置",enableAdvancedFilter:J=!1,advancedColumns:ue=ds,advancedOptionSources:W,showQuickQuery:ne=!1,quickQueries:U,loadQuickQueryFun:Q,saveQuickQueryFun:X,singleLine:K=!1}=e,le=i.useRef(S.emptyFilter()),T=i.useRef(null),[f,N]=i.useState(null),M=i.useRef(null),B=i.useCallback(h=>{T.current=h,N(h)},[]),E=i.useCallback(()=>T.current,[]),G=i.useCallback((h,x)=>l(h,le.current,x),[l]),q=i.useCallback(h=>{var x,Y;le.current=h,(x=e.onSearch)==null||x.call(e,h),(Y=T.current)==null||Y.reload()},[e.onSearch]),Z=i.useCallback(()=>{var h,x;le.current=S.emptyFilter(),(h=e.onReset)==null||h.call(e),(x=T.current)==null||x.reload()},[e.onReset]);return i.useImperativeHandle(r,()=>({get table(){return E()},get filterPanel(){return M.current},get meta(){var h;return((h=E())==null?void 0:h.meta)??null},get paged(){var h;return((h=E())==null?void 0:h.paged)??null},get currentPage(){var h;return((h=E())==null?void 0:h.currentPage)??1},get viewMode(){var h;return((h=E())==null?void 0:h.viewMode)??"table"},get selectable(){var h;return((h=E())==null?void 0:h.selectable)??!1},get columnResizable(){var h;return((h=E())==null?void 0:h.columnResizable)??!0},get stickyHeader(){var h;return((h=E())==null?void 0:h.stickyHeader)??!1},get slotNames(){var h;return((h=E())==null?void 0:h.slotNames)??ys},get selectedRows(){var h;return((h=E())==null?void 0:h.selectedRows)??ms},get rows(){var h;return((h=E())==null?void 0:h.rows)??hs},reload:()=>{var h;(h=E())==null||h.reload()},refresh:()=>{var h;(h=E())==null||h.refresh()},setViewMode:h=>{var x;(x=E())==null||x.setViewMode(h)},setSelectable:h=>{var x;(x=E())==null||x.setSelectable(h)},setColumnResizable:h=>{var x;(x=E())==null||x.setColumnResizable(h)},setStickyHeader:h=>{var x;(x=E())==null||x.setStickyHeader(h)},clearSelection:()=>{var h;(h=E())==null||h.clearSelection()},selectAllOnPage:()=>{var h;(h=E())==null||h.selectAllOnPage()},invertSelectionOnPage:()=>{var h;(h=E())==null||h.invertSelectionOnPage()},openConfigDialog:()=>{var h;(h=E())==null||h.openConfigDialog()},openExportDialog:()=>{var h;(h=E())==null||h.openExportDialog()}}),[E]),t.jsxs("div",{className:"yk-table-page",children:[t.jsx("div",{className:"yk-table-page__filter",children:t.jsx(Qn,{ref:M,showSearch:L,showReset:v,searchButtonText:A,resetButtonText:$,enableAdvancedFilter:J,advancedColumns:ue,advancedOptionSources:W,showQuickQuery:ne,quickQueries:U,loadQuickQueryFun:Q,saveQuickQueryFun:X,singleLine:K,onSearch:q,onReset:Z,onUpdateQuickQueries:e.onUpdateQuickQueries,children:e.children})}),t.jsx("div",{className:"yk-table-page__command",children:t.jsx(Hn,{actions:z,table:f,showActionMenuButton:P,children:e.commandBar})}),t.jsx("div",{className:"yk-table-page__table",children:t.jsx(Cn,{ref:B,metaFun:s,dataFun:G,rowActionsFunc:a,pageSize:c,pageSizes:o,showCheckbox:d,columnResizable:m,stickyHeader:k,loadCustomConfigFun:b,saveCustomConfigFun:w,exportPageSize:p,exportorFunc:j,rowKey:F,viewMode:R,onDataLoaded:e.onDataLoaded,onUpdateViewMode:e.onUpdateViewMode,onUpdateShowCheckbox:e.onUpdateShowCheckbox,onUpdateColumnResizable:e.onUpdateColumnResizable,onUpdateStickyHeader:e.onUpdateStickyHeader,card:kn(e.card),list:kn(e.list),empty:Bt(e.empty),loading:Bt(e.loading),footer:Bt(e.footer)})})]})});Wn.displayName="YsTablePage";const qn=i.forwardRef(function(e,r){const{dataFun:s,pageSize:l=20,threshold:a=100,rowKey:c="id",height:o="100%",immediate:d=!0,showCheckbox:m=!1,metaFun:k,exportorFunc:b,exportPageSize:w=1e3}=e,[p,j]=i.useState([]),[F,R]=i.useState(!1),[z,P]=i.useState(!1),[L,v]=i.useState(!0),[A,$]=i.useState(null),[J,ue]=i.useState(0),[W,ne]=i.useState(null),U=i.useRef([]),Q=i.useRef(!1),X=i.useRef(!1),K=i.useRef(!0),le=i.useRef(null),T=i.useRef(e.dataFun),f=i.useRef(e.metaFun),N=i.useRef(l),M=i.useRef({onDataLoaded:e.onDataLoaded,onError:e.onError,onSelectionChange:e.onSelectionChange});T.current=e.dataFun,f.current=e.metaFun,N.current=l,le.current=W,M.current={onDataLoaded:e.onDataLoaded,onError:e.onError,onSelectionChange:e.onSelectionChange};const B=V.useSelection({rows:p,rowKey:c}),E=i.useRef(B);E.current=B;const G=i.useRef(!1);i.useEffect(()=>{var O,te;if(!G.current){G.current=!0;return}(te=(O=M.current).onSelectionChange)==null||te.call(O,[...B.selectedRows])},[B.selectedRows]);const q=i.useCallback(async O=>{var te,H,ie,Ee;if(O){if(X.current||Q.current||!K.current)return;X.current=!0,P(!0)}else{if(Q.current)return;Q.current=!0,R(!0),$(null)}try{const Ie=O?U.current.length:0,_e=await T.current({limit:N.current,offset:Ie}),Ve=_e.items,Qe=O?[...U.current,...Ve]:Ve;U.current=Qe,j(Qe);const He=_e.hasNext??!1;K.current=He,v(He),_e.totalCount!=null&&ue(_e.totalCount),(H=(te=M.current).onDataLoaded)==null||H.call(te,_e,O)}catch(Ie){$(Ie),(Ee=(ie=M.current).onError)==null||Ee.call(ie,Ie)}finally{O?(X.current=!1,P(!1)):(Q.current=!1,R(!1))}},[]),Z=i.useCallback(()=>{q(!0)},[q]),h=i.useCallback(()=>{K.current=!0,v(!0),q(!1)},[q]),x=i.useCallback(async()=>{const O=f.current;if(!O){ne(null);return}try{ne(await O())}catch{ne(null)}},[]),Y=i.useRef(null),se=i.useRef(null);i.useEffect(()=>{const O=Y.current,te=se.current;if(!O||!te||typeof IntersectionObserver>"u")return;const H=new IntersectionObserver(ie=>{ie.some(Ee=>Ee.isIntersecting)&&K.current&&!Q.current&&!X.current&&Z()},{root:O,rootMargin:`0px 0px ${a}px 0px`,threshold:0});return H.observe(te),()=>H.disconnect()},[a,Z]),i.useEffect(()=>{x(),d&&q(!1)},[]);const me=i.useRef(e.dataFun);i.useEffect(()=>{me.current!==e.dataFun&&(me.current=e.dataFun,h())},[e.dataFun,h]);const we=i.useRef(e.metaFun);i.useEffect(()=>{we.current!==e.metaFun&&(we.current=e.metaFun,x())},[e.metaFun,x]);const be=i.useMemo(()=>{if(W)return W.columns.map((H,ie)=>({column:H,index:ie})).filter(({column:H})=>H.showForDisplay!==!1).sort((H,ie)=>(H.column.displayOrder??H.index)-(ie.column.displayOrder??ie.index)).map(({column:H})=>H);const O=new Set,te=[];for(const H of p)for(const ie of Object.keys(H))O.has(ie)||(O.add(ie),te.push({propertyPath:ie}));return te},[W,p]),et=(W==null?void 0:W.displayName)??"数据",ee=V.useExportExcel({props:{dataFun:s,exportSelected:m,exportorFunc:b},tableName:et,columns:be,currentRows:p,selectedRows:B.selectedRows,total:J,exportPageSize:w,hasMorePage:L,pageScopeLabel:"导出当前已加载"}),ke=i.useRef(ee);ke.current=ee;const je=i.useCallback(()=>{ke.current.onExportClick()},[]);i.useImperativeHandle(r,()=>({get items(){return U.current},get loading(){return Q.current},get loadingMore(){return X.current},get hasMore(){return K.current},get meta(){return le.current},get selectedRows(){return E.current.selectedRows},get rows(){return U.current},reload:h,refresh:h,loadNextPage:Z,isRowSelected:O=>E.current.isRowSelected(O),toggleRowSelection:(O,te)=>E.current.toggleRowSelection(O,te),clearSelection:()=>E.current.clearSelection(),selectAllOnPage:()=>E.current.selectAllOnPage(),invertSelectionOnPage:()=>E.current.invertSelectionOnPage(),openExportDialog:je}),[Z,je,h]);function Te(O,te){const H=e.children;return typeof H=="function"?H(O,te):H??t.jsx("pre",{className:"yk-infinite-list__item-json",children:JSON.stringify(O,null,2)})}const Ne=e.error,Re=typeof Ne=="function"?Ne({error:A}):Ne;return t.jsxs("div",{ref:Y,className:"yk-infinite-list",style:{height:o},children:[p.map((O,te)=>t.jsxs("div",{className:`yk-infinite-list__item${m&&B.isRowSelected(O)?" is-selected":""}`,children:[m?t.jsx(u.Checkbox,{className:"yk-infinite-list__item-checkbox",checked:B.isRowSelected(O),onChange:H=>B.toggleRowSelection(O,H.target.checked)}):null,t.jsx("div",{className:"yk-infinite-list__item-body",children:Te(O,te)})]},String(O[c]))),A?t.jsx("div",{className:"yk-infinite-list__status",children:Re??t.jsx(u.Empty,{description:`加载失败:${String(A)}`,children:t.jsx(u.Button,{type:"primary",onClick:h,children:"重试"})})}):!F&&p.length===0?t.jsx("div",{className:"yk-infinite-list__status",children:e.empty??t.jsx(u.Empty,{description:"暂无数据"})}):null,t.jsx("div",{ref:se,className:"yk-infinite-list__sentinel"}),z?t.jsx("div",{className:"yk-infinite-list__loading-more",children:e.loading??t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"yk-infinite-list__spinner"}),t.jsx("span",{children:"加载中..."})]})}):null,!L&&p.length>0&&!F?t.jsx("div",{className:"yk-infinite-list__no-more",children:e.noMore??t.jsx("span",{children:"— 没有更多了 —"})}):null,t.jsx(jn,{open:ee.exportDialogVisible,options:ee.exportOptions,exporting:ee.exporting,fetched:ee.exportFetched,total:ee.exportTotal,totalKnown:ee.exportTotalKnown,percent:ee.exportPercent,etaSeconds:ee.exportEtaSeconds,cancelledVisible:ee.exportCancelledVisible,cancelledRows:ee.exportCancelledRows,onExport:O=>void ee.doExport(O),onCancelExport:ee.cancelExport,onKeepPartial:()=>void ee.keepPartialExport(),onDiscardPartial:()=>void ee.discardPartialExport(),onClose:ee.closeExportDialog})]})});qn.displayName="YsInfiniteList";function gs(n){return n.icon?t.jsx("i",{className:"yk-main-panel__menu-icon",children:n.icon}):void 0}function Lt(n){const e=[];for(const r of n){const s=gs(r),l=t.jsx("span",{className:"yk-main-panel__menu-text",children:r.label});r.children&&r.children.length>0?e.push({key:r.key,icon:s,label:l,children:Lt(r.children)}):e.push({key:r.key,icon:s,label:l})}return e}function xs(){return t.jsx("svg",{viewBox:"0 0 1024 1024",width:"14",height:"14","aria-hidden":"true",className:"yk-main-panel__search-icon",children:t.jsx("path",{fill:"currentColor",d:"M909.098 839.904l-181.22-181.248a341.5 341.5 0 1 0-47.734 48.58l180.56 180.588a33.92 33.92 0 0 0 48.394-47.92zM454.4 745.6a291.2 291.2 0 1 1 291.2-291.2 291.2 291.2 0 0 1-291.2 291.2z"})})}function ps({nodesFunc:n,componentMap:e,defaultActive:r="",showMenuSearch:s=!0,menuKeyword:l="",onUpdateMenuKeyword:a,onTabChange:c}){const[o,d]=i.useState(!1),[m,k]=i.useState(l);i.useEffect(()=>{k(l)},[l]);const b=f=>{k(f),a==null||a(f)},w=m.trim().length>0,{nodes:p,menuLoading:j}=V.useMainPanelNodes({nodesFunc:n}),{openTabs:F,activeKey:R,setActiveKey:z,openTab:P,removeTab:L,getComponent:v}=V.useMainPanelTabs({componentMap:e}),A=i.useMemo(()=>V.filterNodesByKeyword(p,m),[p,m]),$=i.useMemo(()=>V.collectGroupKeys(A),[A]),J=i.useMemo(()=>Lt(p),[p]),ue=i.useMemo(()=>Lt(A),[A]),W=({key:f})=>{const N=V.findNode(p,f);N&&!V.isGroupNode(N)&&P(N)},ne=i.useRef(p),U=i.useRef(!1),Q=i.useRef(!1);i.useEffect(()=>{if(!U.current)if(p!==ne.current)U.current=!0;else return;if(Q.current||(Q.current=!0,!r))return;const f=V.findNode(p,r);f&&!V.isGroupNode(f)&&P(f)},[p,r,P]);const X=i.useRef(R),K=i.useRef(c);K.current=c,i.useEffect(()=>{var f;X.current!==R&&(X.current=R,(f=K.current)==null||f.call(K,R))},[R]);const le=F.map(f=>{const N=f.componentPath?v(f.componentPath):null;return{key:f.key,label:f.label,closable:!0,forceRender:!0,children:N?t.jsx(i.Suspense,{fallback:t.jsx("div",{className:"yk-main-panel__loading",children:t.jsx(u.Spin,{size:"small"})}),children:t.jsx(N,{...f.props??{}})}):null}}),T="yk-main-panel__menu";return t.jsxs("div",{className:"yk-main-panel",children:[t.jsxs("aside",{className:`yk-main-panel__aside${o?" is-collapsed":""}`,children:[t.jsxs("div",{className:"yk-main-panel__aside-header",children:[t.jsx(u.Button,{type:"text",size:"small",className:"yk-main-panel__collapse-btn",title:o?"展开菜单":"折叠菜单",onClick:()=>d(f=>!f),children:"☰"}),s&&!o&&t.jsx(u.Input,{className:"yk-main-panel__aside-search",size:"small",allowClear:!0,placeholder:"搜索功能","aria-label":"搜索功能",value:m,prefix:t.jsx(xs,{}),onChange:f=>b(f.target.value)})]}),t.jsx("div",{className:"yk-main-panel__menu-wrap",children:t.jsx(u.Spin,{spinning:j,size:"small",children:w?t.jsxs(t.Fragment,{children:[t.jsx(u.Menu,{mode:"inline",className:T,inlineCollapsed:o,items:ue,selectedKeys:R?[R]:[],defaultOpenKeys:$,onClick:W},`search-${m}`),A.length===0&&!j&&t.jsx("div",{className:"yk-main-panel__menu-empty",children:"未找到匹配的功能"})]}):t.jsx(u.Menu,{mode:"inline",className:T,inlineCollapsed:o,items:J,selectedKeys:R?[R]:[],onClick:W},"full")})})]}),t.jsx("main",{className:"yk-main-panel__main",children:F.length>0?t.jsx(u.Tabs,{className:"yk-main-panel__tabs",type:"editable-card",hideAdd:!0,activeKey:R,items:le,onChange:f=>z(f),onEdit:(f,N)=>{N==="remove"&&typeof f!="object"&&L(f)}}):t.jsx("div",{className:"yk-main-panel__empty",children:t.jsx(u.Empty,{description:"暂无打开的功能,从左侧菜单选择"})})})]})}function lt(n){V.useFilterItem(n.api);const e=n.minWidth??200;return t.jsxs("div",{className:"yk-filter-item",style:{minWidth:`${e}px`},children:[t.jsx("label",{className:"yk-filter-item__label",children:n.label}),t.jsx("div",{className:"yk-filter-item__control",children:n.children})]})}const vs=i.forwardRef(function(e,r){const{value:s,setValue:l,filter:a,reset:c}=V.useTextFilterItem(e),o=i.useMemo(()=>({get filter(){return a},reset:c}),[a,c]);return i.useImperativeHandle(r,()=>o,[o]),t.jsx(lt,{label:e.label,api:o,children:t.jsx(u.Input,{value:s,onChange:d=>l(d.target.value),placeholder:e.placeholder,allowClear:!0})})}),ks=i.forwardRef(function(e,r){const{value:s,setValue:l,filter:a,reset:c}=V.useDateFilterItem(e),o=e.valueFormat??"YYYY-MM-DD",d=i.useMemo(()=>({get filter(){return a},reset:c}),[a,c]);return i.useImperativeHandle(r,()=>d,[d]),t.jsx(lt,{label:e.label,api:d,children:t.jsx(u.DatePicker,{value:s?$e(s):null,format:o,onChange:(m,k)=>l(typeof k=="string"?k:""),placeholder:e.placeholder,allowClear:!0})})}),_s=i.forwardRef(function(e,r){const{value:s,setValue:l,filter:a,reset:c}=V.useDateRangeFilterItem({propertyPath:e.propertyPath,defaultValue:e.defaultValue}),o=e.valueFormat??"YYYY-MM-DD",d=i.useMemo(()=>({get filter(){return a},reset:c}),[a,c]);i.useImperativeHandle(r,()=>d,[d]);const m=s&&s.length===2?[$e(s[0]),$e(s[1])]:null;return t.jsx(lt,{label:e.label,api:d,minWidth:240,children:t.jsx(u.DatePicker.RangePicker,{value:m,format:o,onChange:(k,b)=>{l(k?[b[0],b[1]]:null)},placeholder:[e.startPlaceholder??"开始日期",e.endPlaceholder??"结束日期"],disabledDate:e.disabledDate?k=>{var b;return((b=e.disabledDate)==null?void 0:b.call(e,k.toDate()))??!1}:void 0,allowClear:!0})})}),bs=i.forwardRef(function(e,r){const{value:s,setValue:l,filter:a,reset:c}=V.useEnumFilterItem({op:e.op,propertyPath:e.propertyPath,defaultValue:e.defaultValue,multiple:e.multiple}),[o,d]=i.useState([]),[m,k]=i.useState(!1),b=i.useRef(e.optionsSource);b.current=e.optionsSource,i.useEffect(()=>{let j=!0;return k(!0),b.current().then(F=>{j&&d(F)}).finally(()=>{j&&k(!1)}),()=>{j=!1}},[]);const w=i.useMemo(()=>({get filter(){return a},reset:c}),[a,c]);i.useImperativeHandle(r,()=>w,[w]);const p=o.map(j=>({label:j.label,value:j.value}));return t.jsx(lt,{label:e.label,api:w,children:e.multiple?t.jsx(u.Select,{mode:"multiple",value:Array.isArray(s)?s:[],options:p,onChange:j=>l(j),placeholder:e.placeholder,allowClear:e.clearable??!0,loading:m}):t.jsx(u.Select,{value:s??void 0,options:p,onChange:j=>l(j??null),placeholder:e.placeholder,allowClear:e.clearable??!0,loading:m})})});function Kn(n){if(n==null)return"";if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function js({open:n,row:e,columns:r,saver:s,onClose:l,onSaved:a}){const[c,o]=i.useState({}),[d,m]=i.useState([]);i.useEffect(()=>{if(!n||!e)return;const w={};for(const p of r)w[p.name]=Kn(e.data[p.name]);o(w),m([])},[n,e,r]);function k(){l==null||l()}function b(){if(!e)return;const w={};for(const F of r)w[F.name]=c[F.name]??"";const{row:p,errors:j}=s(e,w);m(j),!(j.length>0)&&(a==null||a(p),k())}return t.jsxs(u.Modal,{open:n,title:e?`编辑第 ${e.rowNumber} 行`:"编辑数据行",width:480,maskClosable:!1,destroyOnClose:!0,onCancel:k,footer:t.jsxs(t.Fragment,{children:[t.jsx(u.Button,{onClick:k,children:"取消"}),t.jsx(u.Button,{type:"primary",onClick:b,children:"保存并重新校验"})]}),children:[d.length>0?t.jsx(u.Alert,{className:"yk-import-row-edit-dialog__alert",type:"error",showIcon:!0,message:t.jsx(t.Fragment,{children:d.map((w,p)=>t.jsx("div",{children:w},p))})}):null,t.jsx(u.Form,{labelCol:{flex:"0 0 92px"},wrapperCol:{flex:"auto"},children:r.map(w=>t.jsx(u.Form.Item,{label:w.name,required:!w.optional,children:t.jsx(u.Input,{value:c[w.name]??"",placeholder:w.optional?"可留空":`请输入${w.name}`,onChange:p=>o(j=>({...j,[w.name]:p.target.value})),onPressEnter:b})},w.name))})]})}const At={valid:{label:"待处理"},invalid:{label:"校验失败",color:"red"},processing:{label:"处理中",color:"orange"},success:{label:"成功",color:"green"},failed:{label:"失败",color:"red"}};function Cs(n){const e=Math.max(0,Math.ceil(n/1e3));if(e<60)return`${e} 秒`;const r=Math.floor(e/60),s=e%60;return s>0?`${r} 分 ${s} 秒`:`${r} 分`}function yt(n){var e;return Array.from(((e=n.dataTransfer)==null?void 0:e.types)??[]).includes("Files")}function Ss(){return t.jsxs("svg",{className:"yk-import-excel__action-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M12 20h9"}),t.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function ws(){return t.jsxs("svg",{className:"yk-import-excel__action-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),t.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),t.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const Ns=i.forwardRef(function(e,r){var ot;const{columns:s,processor:l,parser:a,accept:c=".xlsx",autoScroll:o=!0,title:d,maxHeight:m}=e,{rows:k,fileName:b,sheetName:w,loading:p,processing:j,stopping:F,processingTotal:R,progressDone:z,progressSuccess:P,progressFailed:L,hasData:v,invalidCount:A,selectedCount:$,pendingCount:J,loadFile:ue,syncSelection:W,saveRowEdit:ne,removeRow:U,startProcessing:Q,stopProcessing:X,clear:K}=V.useImportExcel({columns:s,processor:l,parser:a}),le=i.useRef(null),T=i.useRef(null),f=i.useRef(w);f.current=w;const[N,M]=i.useState(0),B=N>0;function E(g){const _=c.split(",").map(re=>re.trim().toLowerCase()).filter(Boolean);if(_.length===0)return!0;const D=g.name.toLowerCase();return _.some(re=>D.endsWith(re))}async function G(g){var _;if(!p){if(!E(g)){u.message.error(`仅支持 ${c} 格式的文件`);return}try{const D=await ue(g);(_=e.onLoaded)==null||_.call(e,D),setTimeout(()=>{const re=f.current;u.message.success(`已加载 ${D.length} 行${re?`(工作表「${re}」)`:""}`)},0)}catch(D){u.message.error(D instanceof Error?D.message:String(D))}}}async function q(g){var re;const _=g.target,D=(re=_.files)==null?void 0:re[0];_.value="",D&&await G(D)}function Z(){var g;(g=le.current)==null||g.click()}function h(g){yt(g)&&M(_=>_+1)}function x(g){yt(g)&&(g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="copy"))}function Y(g){yt(g)&&M(_=>Math.max(0,_-1))}function se(g){var D,re;if(!yt(g))return;g.preventDefault(),M(0);const _=(re=(D=g.dataTransfer)==null?void 0:D.files)==null?void 0:re[0];_&&G(_)}const me=i.useRef(0),[we,be]=i.useState(0);i.useEffect(()=>{if(!j)return;me.current=Date.now(),be(Date.now());const g=setInterval(()=>be(Date.now()),500);return()=>clearInterval(g)},[j]);const et=R<=0?0:Math.min(100,z/R*100),ee=!j||z===0?"预计剩余 计算中…":`预计剩余 ${Cs((we-me.current)/z*(R-z))}`,[ke,je]=i.useState(360);i.useEffect(()=>{const g=T.current;if(!g)return;const _=()=>{var We;const re=((We=g.querySelector(".ant-table-thead"))==null?void 0:We.getBoundingClientRect().height)??39;let De=Math.max(120,Math.floor(g.clientHeight-re-1));typeof m=="number"&&(De=Math.min(De,m)),je(De)};_();const D=new ResizeObserver(_);return D.observe(g),()=>D.disconnect()},[m,v]);const Te=((ot=k.find(g=>g.status==="processing"))==null?void 0:ot.rowNumber)??null;i.useEffect(()=>{var at,ct;if(Te===null||!o)return;const g=(at=T.current)==null?void 0:at.querySelector(".ant-table-body"),_=(ct=T.current)==null?void 0:ct.querySelector(`.ant-table-tbody tr[data-row-key="${Te}"]`);if(!g||!_)return;const D=g.getBoundingClientRect(),re=_.getBoundingClientRect(),De=Math.max(0,g.scrollHeight-g.clientHeight),We=g.scrollTop+(re.top-D.top)-(g.clientHeight-re.height)/2;g.scrollTop=Math.min(De,Math.max(0,Math.round(We)))},[Te,o]);const Ne=k.filter(g=>g.selected).map(g=>g.rowNumber);function Re(g){return g.status!=="invalid"}function O(g){var D;const _=k.filter(re=>g.includes(re.rowNumber));W(_),(D=e.onSelectionChange)==null||D.call(e,_)}async function te(){var g;try{const _=await Q();if(!_)return;if((g=e.onProcessed)==null||g.call(e,_),_.stopped){const D=_.total-_.success-_.failed;u.message.warning(`已停止:成功 ${_.success} 行,失败 ${_.failed} 行,剩余 ${D} 行未处理(可再次「开始处理」续跑)`)}else _.failed===0?u.message.success(`全部处理完成,共 ${_.success} 行`):u.message.warning(`处理完成:成功 ${_.success} 行,失败 ${_.failed} 行`)}catch(_){u.message.error(_ instanceof Error?_.message:String(_))}}const[H,ie]=i.useState(!1),[Ee,Ie]=i.useState(null);function _e(g){return!j&&(g.status==="invalid"||g.status==="failed")}function Ve(g){_e(g)&&(Ie(g),ie(!0))}function Qe(g){var _;(_=e.onRowUpdate)==null||_.call(e,g),u.message.success(`第 ${g.rowNumber} 行已修正,可重新处理`)}function He(g){_e(g)&&u.Modal.confirm({title:"删除数据行",content:`确定删除第 ${g.rowNumber} 行吗?删除后不可恢复。`,okText:"删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:()=>{var _;U(g),(_=e.onRowRemove)==null||_.call(e,g),u.message.success(`已删除第 ${g.rowNumber} 行`)}})}i.useImperativeHandle(r,()=>({openFilePicker:Z,startProcessing:te,stopProcessing:X,clear:K}));const bt=Object.keys(At).map(g=>({text:`${At[g].label}(${k.filter(_=>_.status===g).length})`,value:g})),jt=[{title:"行号",key:"rowNumber",width:70,align:"center",fixed:"left",render:(g,_,D)=>t.jsx("span",{title:`Excel 第 ${_.rowNumber} 行`,children:D+1})},...s.map(g=>({title:g.name,key:g.name,width:120,ellipsis:{showTitle:!0},render:(_,D)=>Kn(D.data[g.name])})),{title:"状态",key:"status",dataIndex:"status",width:200,fixed:"right",className:"yk-import-excel__status-cell",filters:bt,filterMultiple:!1,onFilter:(g,_)=>_.status===g,render:(g,_)=>{const D=At[_.status];return t.jsxs(t.Fragment,{children:[t.jsxs(u.Tag,{color:D.color,children:[_.status==="processing"?t.jsx("span",{className:"yk-import-excel__spin"}):null,D.label]}),_.status==="invalid"?t.jsx("div",{className:"yk-import-excel__msg yk-import-excel__msg--danger",children:_.errors.join(";")}):_.message?t.jsx("div",{className:"yk-import-excel__msg yk-import-excel__msg--danger",children:_.message}):null]})}},{title:"操作",key:"action",width:110,align:"center",fixed:"right",render:(g,_)=>_e(_)?t.jsxs("div",{className:"yk-import-excel__actions",children:[t.jsx(u.Button,{type:"link",size:"small",icon:t.jsx(Ss,{}),onClick:()=>Ve(_),children:"编辑"}),t.jsx(u.Button,{type:"link",size:"small",danger:!0,icon:t.jsx(ws,{}),onClick:()=>He(_),children:"删除"})]}):t.jsx("span",{className:"yk-import-excel__action-placeholder",children:"—"})}],Ct={selectedRowKeys:Ne,columnWidth:44,getCheckboxProps:g=>({disabled:!Re(g)}),onChange:O};return t.jsxs("div",{className:"yk-import-excel",onDragEnter:h,onDragOver:x,onDragLeave:Y,onDrop:se,children:[t.jsx("input",{ref:le,className:"yk-import-excel__file",type:"file",accept:c,onChange:q}),d?t.jsx("div",{className:"yk-import-excel__title",children:d}):null,t.jsxs("div",{className:"yk-import-excel__toolbar",children:[t.jsx(u.Button,{type:"primary",loading:p,onClick:Z,children:"选择 Excel 文件"}),t.jsxs(u.Button,{type:"primary",loading:j,disabled:J===0,onClick:te,children:["开始处理",J>0?`(${J} 行)`:""]}),j?t.jsx(u.Button,{danger:!0,disabled:F,onClick:X,children:F?"正在停止…":"停止"}):null,t.jsx(u.Button,{disabled:!v||j,onClick:K,children:"清空"}),b?t.jsxs("span",{className:"yk-import-excel__file-name",title:b,children:[b,w?`(工作表:${w})`:""]}):null,v?t.jsxs("div",{className:"yk-import-excel__stats",children:[t.jsxs("span",{className:"yk-import-excel__stat",children:["共 ",k.length," 行"]}),t.jsxs("span",{className:"yk-import-excel__stat",children:["已选 ",$]}),t.jsxs("span",{className:"yk-import-excel__stat yk-import-excel__stat--danger",children:["校验失败 ",A]})]}):null]}),j?t.jsxs("div",{className:"yk-import-excel__progress",children:[t.jsx(u.Progress,{className:"yk-import-excel__progress-bar",percent:et,status:"active",format:()=>`${z}/${R}`}),t.jsxs("span",{className:"yk-import-excel__progress-meta",children:["成功 ",P,t.jsxs("span",{className:"yk-import-excel__danger-text",children:[" ","/ 失败 ",L]})]}),t.jsx("span",{className:"yk-import-excel__progress-eta",children:ee})]}):null,t.jsx("div",{ref:T,className:"yk-import-excel__body",children:t.jsx(u.Spin,{spinning:p,wrapperClassName:"yk-import-excel__loading",children:v?t.jsx(u.Table,{className:"yk-import-excel__table",rowKey:"rowNumber",columns:jt,dataSource:k,bordered:!0,size:"small",pagination:!1,rowSelection:Ct,scroll:{x:"max-content",y:ke},rowClassName:(g,_)=>_%2===1?"yk-import-excel__row-alt":""}):t.jsxs("div",{className:"yk-import-excel__empty",onClick:Z,children:[t.jsxs("svg",{className:"yk-import-excel__empty-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),t.jsx("polyline",{points:"14 2 14 8 20 8"}),t.jsx("path",{d:"M12 18v-6"}),t.jsx("polyline",{points:"9.5 14.5 12 12l2.5 2.5"})]}),t.jsx("p",{className:"yk-import-excel__empty-title",children:"点击选择 Excel 文件,或将文件拖拽到此处"}),t.jsxs("p",{className:"yk-import-excel__empty-hint",children:["支持 ",c," 格式,首行需为表头"]})]})})}),B?t.jsx("div",{className:"yk-import-excel__drop-mask",children:t.jsxs("div",{className:"yk-import-excel__drop-tip",children:[t.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M12 15V3"}),t.jsx("polyline",{points:"7 8 12 3 17 8"}),t.jsx("path",{d:"M3 15v4a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-4"})]}),t.jsx("span",{children:"松开鼠标,加载 Excel 文件"})]})}):null,t.jsx(js,{open:H,row:Ee,columns:s,saver:ne,onClose:()=>ie(!1),onSaved:Qe})]})});var $t,gt=bn;if(process.env.NODE_ENV==="production")$t=gt.createRoot,gt.hydrateRoot;else{var _n=gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;$t=function(n,e){_n.usingClientEntryPoint=!0;try{return gt.createRoot(n,e)}finally{_n.usingClientEntryPoint=!1}}}function Rs(){return t.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}function Es(){return t.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"}),t.jsx("path",{d:"M4 16V6a2 2 0 0 1 2-2h10"})]})}const Is=i.forwardRef(function(e,r){const{title:s,width:l,heightValue:a,component:c,componentProps:o,actions:d,onCancel:m,onClosed:k,closeOnClickModal:b,closeOnPressEscape:w,maximizable:p,defaultMaximized:j,contentRef:F,modalHandle:R,destroy:z}=e,[P,L]=i.useState(!0),[v,A]=i.useState(-1),[$,J]=i.useState(p&&j),ue=()=>{p&&J(T=>!T)},W=()=>{L(!1)},ne=()=>{v>=0||(m==null||m(),L(!1))},U=async(T,f)=>{if(!(v>=0)){A(f);try{await T.execute(R)}finally{A(-1)}}};i.useImperativeHandle(r,()=>({close:W,toggleMaximize:ue,isMaximized:()=>$}),[p,$]);const Q=p?t.jsxs("div",{className:"yk-modal__title-row",children:[t.jsx("span",{className:"yk-modal__title-text",children:s}),t.jsx(u.Button,{type:"text",size:"small",className:"yk-modal__maximize",title:$?"还原":"最大化","aria-label":$?"还原":"最大化",onClick:ue,children:$?t.jsx(Es,{}):t.jsx(Rs,{})})]}):s,X=d&&d.length>0?t.jsx("div",{className:"yk-modal__footer",children:d.map((T,f)=>{const{type:N,danger:M}=zt(T.type);return t.jsx(u.Button,{type:N,danger:M,title:T.desc,disabled:v>=0&&v!==f,loading:v===f,onClick:()=>void U(T,f),icon:T.icon?t.jsx("span",{className:"yk-modal__action-icon",children:vt(T.icon)}):void 0,children:T.desc},T.name)})}):null,K={...$?{top:0}:{},...a&&!$?{"--yk-modal-height":a}:{}},le=["yk-modal",$?"yk-modal--maximized":a?"yk-modal--fixed-height":""].filter(Boolean).join(" ");return t.jsx(u.Modal,{open:P,title:Q,width:l,style:K,wrapClassName:le,closable:v<0,maskClosable:b,keyboard:w,destroyOnClose:!0,onCancel:ne,afterClose:()=>{k==null||k(),z()},footer:X,children:i.createElement(c,{...o??{},onClose:W,ref:F})})});function Ps(n){if(n!=null)return typeof n=="number"?`${n}px`:n}function Un(n){const{title:e="",width:r="500px",height:s,component:l,props:a,actions:c,onCancel:o,onClosed:d,closeOnClickModal:m=!1,closeOnPressEscape:k=!1,maximizable:b=!1,defaultMaximized:w=!1}=n,p=document.createElement("div");document.body.appendChild(p);const j=$t(p);let F=!1;const R=()=>{F||(F=!0,j.unmount(),p.remove())},z={current:null},P={current:null},L={close:()=>{var v;return(v=z.current)==null?void 0:v.close()},toggleMaximize:()=>{var v;return(v=z.current)==null?void 0:v.toggleMaximize()},isMaximized:()=>{var v;return((v=z.current)==null?void 0:v.isMaximized())??!1},getContentInstance:()=>P.current??null};return j.render(t.jsx(Is,{ref:z,title:e,width:r,heightValue:Ps(s),component:l,componentProps:a,actions:c,onCancel:o,onClosed:d,closeOnClickModal:m,closeOnPressEscape:k,maximizable:b,defaultMaximized:w,contentRef:P,modalHandle:L,destroy:R})),L}function Os(n){const{confirmText:e="确定",cancelText:r="取消",confirmType:s="primary",onConfirm:l,...a}=n;return Un({...a,actions:[{name:"cancel",desc:r,execute:o=>o.close()},{name:"confirm",desc:e,type:s,execute:async o=>{if(!l){o.close();return}await l(o)!==!1&&o.close()}}]})}Object.defineProperty(exports,"fromArray",{enumerable:!0,get:()=>S.fromArray});Object.defineProperty(exports,"fromBool",{enumerable:!0,get:()=>S.fromBool});Object.defineProperty(exports,"fromObjectItems",{enumerable:!0,get:()=>S.fromObjectItems});Object.defineProperty(exports,"fromOptions",{enumerable:!0,get:()=>S.fromOptions});exports.YsAdvancedConditionGroup=Vt;exports.YsAdvancedFilterPanel=zn;exports.YsAdvancedValueEditor=$n;exports.YsCommandBar=Hn;exports.YsDateFilterItem=ks;exports.YsDateRangeFilterItem=_s;exports.YsEnumFilterItem=bs;exports.YsFilterItemLayout=lt;exports.YsFilterPanel=Qn;exports.YsImportExcel=Ns;exports.YsInfiniteList=qn;exports.YsMainPanel=ps;exports.YsRootFilterPanel=Yn;exports.YsTable=Cn;exports.YsTableActionMenuButton=Qt;exports.YsTablePage=Wn;exports.YsTextFilterItem=vs;exports.openDialog=Os;exports.openModal=Un;
2
+ //# sourceMappingURL=index.cjs.map