@gientech/modual 1.2.0 → 1.2.2

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/database.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsxs as Z,jsx as c,Fragment as ne}from"react/jsx-runtime";import{useState as E,useMemo as T,useRef as q,useEffect as ce}from"react";import{k as K,J as U,i as de,F as De}from"./assets/index-CwZH-3RQ.js";import{a as me}from"./assets/index-CZ9KcyHq.js";import{d as ge}from"./assets/styled-components.browser.esm-DPkS13KC.js";/* empty css */import{aL as $,z as be,aH as Y}from"./assets/index-C_syaGTO.js";import"react-dom";const ye=({url:g,token:z,role:N,eventsEmit:p})=>{const l=me.create({baseURL:g,timeout:1e6});return l.interceptors.request.use(e=>{let s=z;return!s&&!["user/login","user/kaptcha","user/regist"].some(t=>e.url.includes(t))?(p&&p("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=s||"",e.headers.userName=N==="\u672A\u767B\u5F55\u7528\u6237"?"":N,e)}),l.interceptors.response.use(e=>{const s=["user/kaptcha"],a=e.data;if(s.some(I=>e.config.url&&e.config.url.includes(I))||a.size&&a.type)return a;const{success:t,errorMsg:i,errorCode:b}=a;return t?a:(p&&p("request:error_business",{errorCode:b,errorMsg:i||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:a}),!1)},async e=>{var s,a,t,i,b,I,A,C,h;if(e.message==="canceled")return Promise.reject(e);if(p){let B="request:error_network",D={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((s=e==null?void 0:e.response)==null?void 0:s.status)===401?(B="request:error_auth",D={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((t=(a=e==null?void 0:e.response)==null?void 0:a.data)==null?void 0:t.errorCode)==="30013"||((b=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:b.errorCode)==="30023")&&(B="request:error_business",D={errorCode:(A=(I=e==null?void 0:e.response)==null?void 0:I.data)==null?void 0:A.errorCode,errorMsg:((h=(C=e==null?void 0:e.response)==null?void 0:C.data)==null?void 0:h.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),p(B,D)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const s=await l.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:a,data:t}=s;if(a)return t}catch(s){console.log("getDatabaseList error:",s)}},getShareDatabaseList:async e=>{try{const s=await l.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:a,data:t}=s;if(a)return t}catch(s){console.log("getShareDatabaseList error:",s)}},delDatabaseById:async(e,s)=>{const a=O(s);try{const t=await l.delete(`/${a}/deleteDB/${e}`),{success:i,data:b}=t;if(i)return b}catch(t){console.log("delDatabaseById error:",t)}},saveDatabase:async(e,s)=>{const a=O(s);try{const t=await l.post(`/${a}/saveDBInfo`,e),{success:i,data:b}=t;if(i)return b}catch(t){console.log("saveDatabase error:",t)}},testConnection:async e=>{try{const s=await l.post("/directDB/testConnect",e),{success:a,data:t}=s;if(a)return t}catch(s){console.log("testConnection error:",s)}}}},O=g=>g=="DataTable"?"dataTable":"directDB",Ee="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0IDEyQzE0IDEwLjg5NTQgMTQuODk1NCAxMCAxNiAxMEgyOUMzMS4yMDkxIDEwIDMzIDExLjc5MDkgMzMgMTRWMjZDMzMgMzAuNDE4MyAyOS40MTgzIDM0IDI1IDM0SDE2QzE0Ljg5NTQgMzQgMTQgMzMuMTA0NiAxNCAzMlYxMloiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl80NDcyXzE4MDUyKSIvPgo8Zm9yZWlnbk9iamVjdCB4PSItMSIgeT0iLTEiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzNiI+PGRpdiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCIgc3R5bGU9ImJhY2tkcm9wLWZpbHRlcjpibHVyKDJweCk7Y2xpcC1wYXRoOnVybCgjYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgpO2hlaWdodDoxMDAlO3dpZHRoOjEwMCUiPjwvZGl2PjwvZm9yZWlnbk9iamVjdD48ZyBkYXRhLWZpZ21hLWJnLWJsdXItcmFkaXVzPSI0Ij4KPHBhdGggZD0iTTMgN0MzIDQuNzkwODYgNC43OTA4NiAzIDcgM0gyM0MyNS4yMDkxIDMgMjcgNC43OTA4NiAyNyA3VjE5QzI3IDI1LjYyNzQgMjEuNjI3NCAzMSAxNSAzMUg3QzQuNzkwODYgMzEgMyAyOS4yMDkxIDMgMjdWN1oiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNDYiLz4KPHBhdGggZD0iTTcgMy4yNUgyM0MyNS4wNzExIDMuMjUgMjYuNzUgNC45Mjg5MyAyNi43NSA3VjE5QzI2Ljc1IDI1LjQ4OTMgMjEuNDg5MyAzMC43NSAxNSAzMC43NUg3QzQuOTI4OTMgMzAuNzUgMy4yNSAyOS4wNzExIDMuMjUgMjdWN0MzLjI1IDQuOTI4OTMgNC45Mjg5MyAzLjI1IDcgMy4yNVoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjM0IiBzdHJva2Utd2lkdGg9IjAuNSIvPgo8L2c+CjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIxX2RfNDQ3Ml8xODA1MikiPgo8cGF0aCBkPSJNMTQgMTlWMTEuNjY2NyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjgzOTcyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTExIDE0TDEyIDEzTDE0IDExTDE2IDEzTDE3IDE0IiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMjJIMTgiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGQ9Ik0zIDdDMyA0Ljc5MDg2IDQuNzkwODYgMyA3IDNIMjNDMjUuMjA5MSAzIDI3IDQuNzkwODYgMjcgN1YxOUMyNyAyNS42Mjc0IDIxLjYyNzQgMzEgMTUgMzFIN0M0Ljc5MDg2IDMxIDMgMjkuMjA5MSAzIDI3VjdaIi8+CjwvY2xpcFBhdGg+PGZpbHRlciBpZD0iZmlsdGVyMV9kXzQ0NzJfMTgwNTIiIHg9IjUiIHk9IjYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIyMSIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4KPGZlT2Zmc2V0Lz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIvPgo8ZmVDb21wb3NpdGUgaW4yPSJoYXJkQWxwaGEiIG9wZXJhdG9yPSJvdXQiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAuMzk2MDc4IDAgMCAwIDAgMC45ODQzMTQgMCAwIDAgMC40IDAiLz4KPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbjI9IkJhY2tncm91bmRJbWFnZUZpeCIgcmVzdWx0PSJlZmZlY3QxX2Ryb3BTaGFkb3dfNDQ3Ml8xODA1MiIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIiByZXN1bHQ9InNoYXBlIi8+CjwvZmlsdGVyPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNDQ3Ml8xODA1MiIgeDE9IjIzLjUiIHkxPSIxMCIgeDI9IjIzLjUiIHkyPSIzNCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjNjRBMEZEIi8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzAxNUFGRiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=",Fe=""+new URL("assets/database_connect.svg",import.meta.url).href,pe=""+new URL("assets/mysql.svg",import.meta.url).href,Ie=""+new URL("assets/SQLServer.png",import.meta.url).href,Me=""+new URL("assets/PostgreSQL.png",import.meta.url).href,fe=""+new URL("assets/Doris.png",import.meta.url).href,Ae=[{label:"MySQL",value:"MySQL",icon:pe},{label:"PostgreSQL",value:"PostgreSQL",icon:Me},{label:"SQLServer",value:"SQLServer",icon:Ie},{label:"Doris",value:"Doris",icon:fe}],Ce=({drawerTitle:g,drawerVisible:z,isConnectSuccess:N,handleDrawerClose:p,dbInfo:l,dbType:d,eventsEmit:f})=>{const[W,R]=E(!1),[V,e]=E(!1),[s,a]=E({}),[t,i]=E(!1),b=T(()=>({id:d,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:u=>{if(!u)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(u))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[d,l]),I=T(()=>({id:d,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:u=>{if(!u)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(u))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!l,required:!0,options:Ae.map(u=>{const{label:r,value:M,icon:v}=u;return{label:r,value:M,render:()=>Z("div",{className:"flex items-center gap-2",children:[c("img",{src:v,width:24}),c("span",{children:r})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!l,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!l,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!l,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!l,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:t?!1:!!l}]}]}),[d,l,t]),A=q(null),C=(u,r,M)=>{switch(console.log("[Form] eventsEmit:",u,r,M),u){case"form:ready":r.formRef&&(A.current=r.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",r),a(v=>({...v,[r.fieldId]:r.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",r);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",u,r)}f==null||f(u,r,M)},h=async()=>{try{R(!0);const u=await A.current.getAllData();u.isValid&&(console.log(u,"==="),d=="DirectDB"&&g=="\u7F16\u8F91\u6570\u636E\u5E93"&&!t&&(u.fields=u.fields.filter(r=>r.name=="name"||r.name=="description")),await f("form_submitted",u,void 0),i(!1))}catch(u){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",u)}finally{R(!1)}},B=async()=>{try{e(!0);const u=await A.current.getAllData();if(u.isValid){const r=u.fields.reduce((M,v)=>(M[v.name]=v.value,M),{});await f("form:connect_test",r,void 0)}}catch{e(!1)}finally{e(!1)}},D=T(()=>{const u=d=="DataTable"?b:I;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:u.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:u.id,type:"form",size:"md",formWidth:u.formWidth,formConfig:{layout:u.layout,showReset:!1,showSubmit:!1,formWidth:u.formWidth,getFormData:()=>({...s,timestamp:new Date().toISOString(),formId:u.id}),onFieldChange:(r,M)=>{C("form_field_change",{fieldId:r,value:M},void 0)},onValidationError:r=>{C("form_validation_error",r,void 0)}}}],dataSource:[{id:u.id,fields:u.fields,defaultValues:{...l}}],eventsEmit:C}},[d,b,I,z,l]),H=T(()=>d=="DirectDB"?l?t&&!N:!N:!1,[d,N,t,z]);return Z($,{title:g,width:620,onCancel:()=>{p(),i(!1)},open:z,destroyOnHidden:!0,footer:Z("div",{className:"flex justify-end gap-3",children:[c(U,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{p(),i(!1)}}),c(U,{mode:"primary",label:"\u786E\u8BA4",loading:W,disabled:H,onClick:h})]}),children:[c(K,{...D},"example-form"),d==="DirectDB"&&c(ne,{children:g=="\u7F16\u8F91\u6570\u636E\u5E93"&&!t?c(U,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{i(!0),A.current.setValues({dbPassword:void 0})}}):c(be,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:c(U,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:V,onClick:B})})})]})},he=""+new URL("assets/empty.png",import.meta.url).href,{confirm:Be}=$,we=ge.div`
1
+ import{jsxs as Z,jsx as l,Fragment as de}from"react/jsx-runtime";import{useState as y,useMemo as T,useRef as q,useEffect as De}from"react";import{k as K,J as Q,i as me,F as ge}from"./assets/index-5gkRuYoC.js";import"./assets/index--DG-fVvc.js";import{d as be}from"./assets/styled-components.browser.esm-DPkS13KC.js";import{Modal as $,Tooltip as ye,message as H}from"antd";import Fe from"axios";/* empty css */import"react-dom";const Ee=({url:m,token:z,role:B,eventsEmit:E})=>{const c=Fe.create({baseURL:m,timeout:1e6});return c.interceptors.request.use(e=>{let t=z;return!t&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(E&&E("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=B==="\u672A\u767B\u5F55\u7528\u6237"?"":B,e)}),c.interceptors.response.use(e=>{const t=["user/kaptcha"],r=e.data;if(t.some(p=>e.config.url&&e.config.url.includes(p))||r.size&&r.type)return r;const{success:u,errorMsg:g,errorCode:D}=r;return u?r:(E&&E("request:error_business",{errorCode:D,errorMsg:g||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r}),!1)},async e=>{var t,r,u,g,D,p,C,h,N;if(e.message==="canceled")return Promise.reject(e);if(E){let d="request:error_network",v={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(d="request:error_auth",v={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:u.errorCode)==="30013"||((D=(g=e==null?void 0:e.response)==null?void 0:g.data)==null?void 0:D.errorCode)==="30023")&&(d="request:error_business",v={errorCode:(C=(p=e==null?void 0:e.response)==null?void 0:p.data)==null?void 0:C.errorCode,errorMsg:((N=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:N.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),E(d,v)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const t=await c.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getDatabaseList error:",t)}},getShareDatabaseList:async e=>{try{const t=await c.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getShareDatabaseList error:",t)}},delDatabaseById:async(e,t)=>{const r=O(t);try{const u=await c.delete(`/${r}/deleteDB/${e}`),{success:g,data:D}=u;if(g)return D}catch(u){console.log("delDatabaseById error:",u)}},saveDatabase:async(e,t)=>{const r=O(t);try{const u=await c.post(`/${r}/saveDBInfo`,e),{success:g,data:D}=u;if(g)return D}catch(u){console.log("saveDatabase error:",u)}},testConnection:async e=>{try{const t=await c.post("/directDB/testConnect",e),{success:r,data:u}=t;if(r)return u}catch(t){console.log("testConnection error:",t)}},syncSchema:async e=>{try{const t=await c.get(`/directDB/syncSchema/${e}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("syncSchema error:",t)}}}},O=m=>m=="DataTable"?"dataTable":"directDB",pe="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0IDEyQzE0IDEwLjg5NTQgMTQuODk1NCAxMCAxNiAxMEgyOUMzMS4yMDkxIDEwIDMzIDExLjc5MDkgMzMgMTRWMjZDMzMgMzAuNDE4MyAyOS40MTgzIDM0IDI1IDM0SDE2QzE0Ljg5NTQgMzQgMTQgMzMuMTA0NiAxNCAzMlYxMloiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl80NDcyXzE4MDUyKSIvPgo8Zm9yZWlnbk9iamVjdCB4PSItMSIgeT0iLTEiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzNiI+PGRpdiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCIgc3R5bGU9ImJhY2tkcm9wLWZpbHRlcjpibHVyKDJweCk7Y2xpcC1wYXRoOnVybCgjYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgpO2hlaWdodDoxMDAlO3dpZHRoOjEwMCUiPjwvZGl2PjwvZm9yZWlnbk9iamVjdD48ZyBkYXRhLWZpZ21hLWJnLWJsdXItcmFkaXVzPSI0Ij4KPHBhdGggZD0iTTMgN0MzIDQuNzkwODYgNC43OTA4NiAzIDcgM0gyM0MyNS4yMDkxIDMgMjcgNC43OTA4NiAyNyA3VjE5QzI3IDI1LjYyNzQgMjEuNjI3NCAzMSAxNSAzMUg3QzQuNzkwODYgMzEgMyAyOS4yMDkxIDMgMjdWN1oiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNDYiLz4KPHBhdGggZD0iTTcgMy4yNUgyM0MyNS4wNzExIDMuMjUgMjYuNzUgNC45Mjg5MyAyNi43NSA3VjE5QzI2Ljc1IDI1LjQ4OTMgMjEuNDg5MyAzMC43NSAxNSAzMC43NUg3QzQuOTI4OTMgMzAuNzUgMy4yNSAyOS4wNzExIDMuMjUgMjdWN0MzLjI1IDQuOTI4OTMgNC45Mjg5MyAzLjI1IDcgMy4yNVoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjM0IiBzdHJva2Utd2lkdGg9IjAuNSIvPgo8L2c+CjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIxX2RfNDQ3Ml8xODA1MikiPgo8cGF0aCBkPSJNMTQgMTlWMTEuNjY2NyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjgzOTcyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTExIDE0TDEyIDEzTDE0IDExTDE2IDEzTDE3IDE0IiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMjJIMTgiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGQ9Ik0zIDdDMyA0Ljc5MDg2IDQuNzkwODYgMyA3IDNIMjNDMjUuMjA5MSAzIDI3IDQuNzkwODYgMjcgN1YxOUMyNyAyNS42Mjc0IDIxLjYyNzQgMzEgMTUgMzFIN0M0Ljc5MDg2IDMxIDMgMjkuMjA5MSAzIDI3VjdaIi8+CjwvY2xpcFBhdGg+PGZpbHRlciBpZD0iZmlsdGVyMV9kXzQ0NzJfMTgwNTIiIHg9IjUiIHk9IjYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIyMSIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4KPGZlT2Zmc2V0Lz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIvPgo8ZmVDb21wb3NpdGUgaW4yPSJoYXJkQWxwaGEiIG9wZXJhdG9yPSJvdXQiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAuMzk2MDc4IDAgMCAwIDAgMC45ODQzMTQgMCAwIDAgMC40IDAiLz4KPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbjI9IkJhY2tncm91bmRJbWFnZUZpeCIgcmVzdWx0PSJlZmZlY3QxX2Ryb3BTaGFkb3dfNDQ3Ml8xODA1MiIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIiByZXN1bHQ9InNoYXBlIi8+CjwvZmlsdGVyPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNDQ3Ml8xODA1MiIgeDE9IjIzLjUiIHkxPSIxMCIgeDI9IjIzLjUiIHkyPSIzNCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjNjRBMEZEIi8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzAxNUFGRiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=",Ie=""+new URL("assets/database_connect.svg",import.meta.url).href,Me=""+new URL("assets/MySQL.svg",import.meta.url).href,fe=""+new URL("assets/SQLServer.png",import.meta.url).href,Ae=""+new URL("assets/PostgreSQL.png",import.meta.url).href,Ce=""+new URL("assets/Doris.png",import.meta.url).href,he=[{label:"MySQL",value:"MySQL",icon:Me},{label:"PostgreSQL",value:"PostgreSQL",icon:Ae},{label:"SQLServer",value:"SQLServer",icon:fe},{label:"Doris",value:"Doris",icon:Ce}],Be=({drawerTitle:m,drawerVisible:z,isConnectSuccess:B,handleDrawerClose:E,dbInfo:c,dbType:n,eventsEmit:M})=>{const[G,W]=y(!1),[R,w]=y(!1),[e,t]=y({}),[r,u]=y(!1),g=T(()=>({id:n,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[n,c]),D=T(()=>({id:n,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!c,required:!0,options:he.map(a=>{const{label:i,value:I,icon:x}=a;return{label:i,value:I,render:()=>Z("div",{className:"flex items-center gap-2",children:[l("img",{src:x,width:24}),l("span",{children:i})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:r?!1:!!c}]}]}),[n,c,r]),p=q(null),C=(a,i,I)=>{switch(console.log("[Form] eventsEmit:",a,i,I),a){case"form:ready":i.formRef&&(p.current=i.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",i),t(x=>({...x,[i.fieldId]:i.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",i);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,i)}M==null||M(a,i,I)},h=async()=>{try{W(!0);const a=await p.current.getAllData();a.isValid&&(console.log(a,"==="),n=="DirectDB"&&m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r&&(a.fields=a.fields.filter(i=>i.name=="name"||i.name=="description")),await M("form_submitted",a,void 0),u(!1))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{W(!1)}},N=async()=>{try{w(!0);const a=await p.current.getAllData();if(a.isValid){const i=a.fields.reduce((I,x)=>(I[x.name]=x.value,I),{});await M("form:connect_test",i,void 0)}}catch{w(!1)}finally{w(!1)}},d=T(()=>{const a=n=="DataTable"?g:D;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:a.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:a.id,type:"form",size:"md",formWidth:a.formWidth,formConfig:{layout:a.layout,showReset:!1,showSubmit:!1,formWidth:a.formWidth,getFormData:()=>({...e,timestamp:new Date().toISOString(),formId:a.id}),onFieldChange:(i,I)=>{C("form_field_change",{fieldId:i,value:I},void 0)},onValidationError:i=>{C("form_validation_error",i,void 0)}}}],dataSource:[{id:a.id,fields:a.fields,defaultValues:{...c}}],eventsEmit:C}},[n,g,D,z,c]),v=T(()=>n=="DirectDB"?c?r&&!B:!B:!1,[n,B,r,z]);return Z($,{title:m,width:620,onCancel:()=>{E(),u(!1)},open:z,destroyOnHidden:!0,footer:Z("div",{className:"flex justify-end gap-3",children:[l(Q,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{E(),u(!1)}}),l(Q,{mode:"primary",label:"\u786E\u8BA4",loading:G,disabled:v,onClick:h})]}),children:[l(K,{...d},"example-form"),n==="DirectDB"&&l(de,{children:m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r?l(Q,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{u(!0),p.current.setValues({dbPassword:void 0})}}):l(ye,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:l(Q,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:R,onClick:N})})})]})},we=""+new URL("assets/empty.png",import.meta.url).href,{confirm:Ne}=$,ve=be.div`
2
2
  width: 282px;
3
3
  height: 81px;
4
4
  display: flex;
@@ -17,4 +17,4 @@ import{jsxs as Z,jsx as c,Fragment as ne}from"react/jsx-runtime";import{useState
17
17
  background-color: #F1F5FF;
18
18
  };
19
19
  border: 1px solid #EBEBEB
20
- `,Ne=[{key:"add_file_db",label:"\u4E0A\u4F20\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0A\u4F20Excel\u3001csv\u7B49\u683C\u5F0F\u6570\u636E\u8868\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Ee},{key:"add_direct_db",label:"\u76F4\u8FDE\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0E\u5DF2\u6709\u4E1A\u52A1\u5EFA\u7ACB\u8FDE\u63A5\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Fe}],Pe=g=>{const{url:z,token:N,role:p,CustomComponents:l,getBtnDisabled:d}=g,[f,W]=E("my-db"),[R,V]=E({app:"ready",container:"ready",content:"ready"}),[e,s]=E(!1),[a,t]=E([{id:"my-db",data:[]},{id:"shared-db",data:[]}]),i=q(null),[b,I]=E(!1),[A,C]=E(""),[h,B]=E("DataTable"),[D,H]=E(),[u,r]=E(!1),{getDatabaseList:M,delDatabaseById:v,saveDatabase:ee,testConnection:ue,getShareDatabaseList:te}=ye({url:z,token:N,role:p,eventsEmit:g.eventsEmit}),_=T(()=>[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"my-db",type:"card",cardType:"database",rowHeight:220,viewPageSize:12,viewBehavior:"pagination",actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}],toolbar:[{type:"customized",key:"add",render:()=>c(de,{mode:"primary",label:"\u521B\u5EFA\u6570\u636E\u5E93",actions:Ne.map(n=>({key:n.key,component:c(we,{children:Z("div",{className:"flex flex-grow",children:[c("div",{className:"mr-[6px]",children:c("img",{src:n.icon})}),Z("div",{children:[c("div",{className:"text-base font-bold mb-1 text-[14px]",children:n.label}),c("div",{className:"text-[#888] text-[10px]",children:n.dsc})]})]})},n.key)})),eventEmit:J})},{type:"fuzzy_search",key:"search",label:"\u8F93\u5165\u540D\u79F0\u641C\u7D22",searchKeys:["name","description"],position:"right"}]},{label:"\u5171\u4EAB\u6570\u636E\u5E93",id:"shared-db",type:"card",cardType:"database",rowHeight:240,toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",position:"right"}],actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}]}],[]);ce(()=>{V(n=>({...n,content:"loading"})),ae()},[]);const ae=async()=>{var n,o,L,j;try{const[w,k]=await Promise.allSettled([M({pageNo:1,pageSize:999}),te({pageNo:1,pageSize:999})]);let P=[];if(w.status==="fulfilled"&&w.value&&(n=w.value)!=null&&n.records){const x=(((o=w.value)==null?void 0:o.records)||[]).map(m=>({...m,actions:Q("my-db").map((y,S)=>({...y,key:y.type==="divider"?`${y.key}_${m.id}`:y.key,disabled:d&&d(y.key=="edit"?7:4,m.permission)}))}));P.push({id:"my-db",data:x||[]})}if(k.status==="fulfilled"&&k.value&&(L=k.value)!=null&&L.records){const x=(((j=k.value)==null?void 0:j.records)||[]).map(m=>({...m,actions:Q("shared-db").map((y,S)=>({...y,key:y.type==="divider"?`${y.key}_${m.id}`:y.key,disabled:d&&d(y.key=="edit"?7:4,m.permission)}))}));P.push({id:"shared-db",data:x||[]})}t(P),V(x=>({...x,content:"ready"}))}catch(w){console.log("[DatabaseApiError] getDatabaseList:",w)}},se="admin",ie=()=>Z("div",{className:"flex flex-col items-center justify-center h-full",children:[c("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:c("img",{src:he,width:120})}),c("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5E93"})]}),Q=n=>{const o=_.find(j=>j.id===n);return(o==null?void 0:o.actions)||[]},re=T(()=>{var o;const n=((o=a==null?void 0:a.find(L=>L.id===f))==null?void 0:o.data)||[];return e?[]:n},[f,a,e]),X=()=>{I(!1),r(!1),H(void 0)},oe=async n=>{console.log("[DatabaseViewAdopter] \u6D4B\u8BD5\u8FDE\u63A5:",n);const o=await ue(n);return o&&(r(!0),Y.success("\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F\uFF01")),o};async function J(n,o,L){var j,w,k,P,x;switch(console.log("[DatabaseViewAdopter] mergedEventsEmit",n,o),n){case"card_delete":Be({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await v(o.id,o.datasourceType)&&(i!=null&&i.current)&&(i==null||i.current.appFn.removeItem(o.id))},onCancel(){console.log("Cancel")}});break;case"card_edit":C("\u7F16\u8F91\u6570\u636E\u5E93"),I(!0),B(o.datasourceType),delete o.render,H(o);break;case"select":W(o.id);break;case"filesDir_clicked":W(o.id);break;case"dropdown_action":C("\u521B\u5EFA\u6570\u636E\u5E93"),I(!0),o.key=="add_file_db"?B("DataTable"):B("DirectDB");break;case"form_submitted":try{const m=o.fields.reduce((G,F)=>(G[F.name]=F.value,G),{}),y=D?{id:D==null?void 0:D.id,...m}:m,S=await ee(y,h);if(S){if(D){const G={...D,...m,datasourceType:h,actions:Q("my-db").map((F,le)=>({...F,key:F.type==="divider"?`${F.key}_${S}`:F.key,allow:!0}))};(w=(j=i==null?void 0:i.current)==null?void 0:j.appFn)==null||w.updateItem(G,D==null?void 0:D.id),Y.success("\u6570\u636E\u5E93\u7F16\u8F91\u6210\u529F\uFF01")}else{const G={...m,...S,createBy:se,datasourceType:h,actions:Q("my-db").map((F,le)=>({...F,key:F.type==="divider"?`${F.key}_${S}`:F.key,allow:!0}))};(P=(k=i==null?void 0:i.current)==null?void 0:k.appFn)==null||P.addItem(G,{animate:!0,position:"start"}),Y.success("\u6570\u636E\u5E93\u521B\u5EFA\u6210\u529F\uFF01")}return S}}catch(m){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",m)}finally{X()}break;case"form:connect_test":return await oe(o);case"toolbar_test_empty":console.log("[DatabaseViewAdopter] toolbar_test_empty \u4E8B\u4EF6\u89E6\u53D1"),s(!e);break;default:(x=g.eventsEmit)==null||x.call(g,n,o);break}}return Z(De,{title:"\u6570\u636E\u5E93\u7BA1\u7406",children:[c(K,{ref:i,label:"",model:"tabs",defaultActiveId:f,views:_,dataSource:re,eventsEmit:J,status:R,CustomComponents:{EmptyData:ie,...l},styles:g.styles},"db"),c(Ce,{drawerTitle:A,drawerVisible:b,isConnectSuccess:u,dbType:h,dbInfo:D,handleDrawerClose:X,eventsEmit:J})]})};export{Pe as default};
20
+ `,xe=[{key:"add_file_db",label:"\u4E0A\u4F20\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0A\u4F20Excel\u3001csv\u7B49\u683C\u5F0F\u6570\u636E\u8868\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:pe},{key:"add_direct_db",label:"\u76F4\u8FDE\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0E\u5DF2\u6709\u4E1A\u52A1\u5EFA\u7ACB\u8FDE\u63A5\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Ie}],Re=m=>{const{url:z,token:B,role:E,CustomComponents:c,getBtnDisabled:n}=m,[M,G]=y("my-db"),[W,R]=y({app:"ready",container:"ready",content:"ready"}),[w,e]=y(!1),[t,r]=y([{id:"my-db",data:[]},{id:"shared-db",data:[]}]),u=q(null),[g,D]=y(!1),[p,C]=y(""),[h,N]=y("DataTable"),[d,v]=y(),[a,i]=y(!1),{getDatabaseList:I,delDatabaseById:x,saveDatabase:ee,testConnection:ue,getShareDatabaseList:te,syncSchema:ae}=Ee({url:z,token:B,role:E,eventsEmit:m.eventsEmit}),J=T(()=>[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"my-db",type:"card",cardType:"database",rowHeight:220,viewPageSize:12,viewBehavior:"pagination",actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}],toolbar:[{type:"customized",key:"add",render:()=>l(me,{mode:"primary",label:"\u521B\u5EFA\u6570\u636E\u5E93",actions:xe.map(o=>({key:o.key,component:l(ve,{children:Z("div",{className:"flex flex-grow",children:[l("div",{className:"mr-[6px]",children:l("img",{src:o.icon})}),Z("div",{children:[l("div",{className:"text-base font-bold mb-1 text-[14px]",children:o.label}),l("div",{className:"text-[#888] text-[10px]",children:o.dsc})]})]})},o.key)})),eventEmit:_})},{type:"fuzzy_search",key:"search",label:"\u8F93\u5165\u540D\u79F0\u641C\u7D22",searchKeys:["name","description"],position:"right"}]},{label:"\u5171\u4EAB\u6570\u636E\u5E93",id:"shared-db",type:"card",cardType:"database",rowHeight:240,toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",position:"right"}],actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}]}],[t]);De(()=>{R(o=>({...o,content:"loading"})),se()},[]);const se=async()=>{var o,s,f,b;try{const[A,j]=await Promise.allSettled([I({pageNo:1,pageSize:999}),te({pageNo:1,pageSize:999})]);let L=[];if(A.status==="fulfilled"&&A.value&&(o=A.value)!=null&&o.records){const S=Y((s=A.value)==null?void 0:s.records);L.push({id:"my-db",data:S||[]})}if(j.status==="fulfilled"&&j.value&&(f=j.value)!=null&&f.records){const S=Y((b=j.value)==null?void 0:b.records);L.push({id:"shared-db",data:S||[]})}r(L),R(S=>({...S,content:"ready"}))}catch(A){console.log("[DatabaseApiError] getDatabaseList:",A)}},Y=o=>(o||[]).map(s=>{const f=U("shared-db").map((b,A)=>({...b,key:b.type==="divider"?`${b.key}_${s.id}`:b.key,disabled:n&&n(b.key=="edit"?7:4,s.permission)}));return s.datasourceType=="DirectDB"&&f.push({label:"\u540C\u6B65\u8868\u7ED3\u6784",key:"sync_schema",disabled:n&&n(7,s.permission)}),console.log("[DatabaseViewAdopter] actions:",f),{...s,actions:f||[]}}),re="admin",ie=()=>Z("div",{className:"flex flex-col items-center justify-center h-full",children:[l("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:l("img",{src:we,width:120})}),l("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5E93"})]}),U=o=>{const s=J.find(b=>b.id===o);return(s==null?void 0:s.actions)||[]},oe=T(()=>{var s;const o=((s=t==null?void 0:t.find(f=>f.id===M))==null?void 0:s.data)||[];return w?[]:o},[M,t,w]),X=()=>{D(!1),i(!1),v(void 0)},ce=async o=>{console.log("[DatabaseViewAdopter] \u6D4B\u8BD5\u8FDE\u63A5:",o);const s=await ue(o);return s&&(i(!0),H.success("\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F\uFF01")),s};async function _(o,s,f){var b,A,j,L,S;switch(console.log("[DatabaseViewAdopter] mergedEventsEmit",o,s),o){case"card_delete":Ne({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await x(s.id,s.datasourceType)&&(u!=null&&u.current)&&(u==null||u.current.appFn.removeItem(s.id))},onCancel(){console.log("Cancel")}});break;case"card_edit":C("\u7F16\u8F91\u6570\u636E\u5E93"),D(!0),N(s.datasourceType),delete s.render,v(s);break;case"select":G(s.id);break;case"filesDir_clicked":G(s.id);break;case"dropdown_action":C("\u521B\u5EFA\u6570\u636E\u5E93"),D(!0),s.key=="add_file_db"?N("DataTable"):N("DirectDB");break;case"form_submitted":try{const k=s.fields.reduce((P,F)=>(P[F.name]=F.value,P),{}),le=d?{id:d==null?void 0:d.id,...k}:k,V=await ee(le,h);if(V){if(d){const P={...d,...k,datasourceType:h,actions:U("my-db").map((F,ne)=>({...F,key:F.type==="divider"?`${F.key}_${V}`:F.key,allow:!0}))};(A=(b=u==null?void 0:u.current)==null?void 0:b.appFn)==null||A.updateItem(P,d==null?void 0:d.id),H.success("\u6570\u636E\u5E93\u7F16\u8F91\u6210\u529F\uFF01")}else{const P={...k,...V,createBy:re,datasourceType:h,actions:U("my-db").map((F,ne)=>({...F,key:F.type==="divider"?`${F.key}_${V}`:F.key,allow:!0}))};(L=(j=u==null?void 0:u.current)==null?void 0:j.appFn)==null||L.addItem(P,{animate:!0,position:"start"}),H.success("\u6570\u636E\u5E93\u521B\u5EFA\u6210\u529F\uFF01")}return V}}catch(k){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",k)}finally{X()}break;case"form:connect_test":return await ce(s);case"toolbar_test_empty":console.log("[DatabaseViewAdopter] toolbar_test_empty \u4E8B\u4EF6\u89E6\u53D1"),e(!w);break;case"card_sync_schema":await ae(s.id)&&(i(!0),H.success("\u540C\u6B65\u8868\u7ED3\u6784\u6210\u529F\uFF01"));break;default:(S=m.eventsEmit)==null||S.call(m,o,s);break}}return Z(ge,{title:"\u6570\u636E\u5E93\u7BA1\u7406",children:[l(K,{ref:u,label:"",model:"tabs",defaultActiveId:M,views:J,dataSource:oe,eventsEmit:_,status:W,CustomComponents:{EmptyData:ie,...c},styles:m.styles},"db"),l(Be,{drawerTitle:p,drawerVisible:g,isConnectSuccess:a,dbType:h,dbInfo:d,handleDrawerClose:X,eventsEmit:_})]})};export{Re as default};
package/databaseId.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as v,Fragment as Ce}from"react/jsx-runtime";import{useMemo as J,useState as C,useRef as Fe,useCallback as j,useEffect as De}from"react";import{u as Me}from"./assets/index-CpW6Dhpp.js";import{k as be,J as $,C as Se,S as ze,F as Le}from"./assets/index-CwZH-3RQ.js";import{c as ue,a as _e}from"./assets/index-CZ9KcyHq.js";/* empty css */import{T as Ae}from"./assets/index-CkrtMipy.js";import{aH as X,aL as fe,z as pe,aM as Ve}from"./assets/index-C_syaGTO.js";import{D as Be}from"./assets/index-DhLqP5fb.js";import{X as me}from"./assets/x-CRBeKR4J.js";import{a as Ne}from"./assets/index-CtbH8bkI.js";import{B as Ee}from"./assets/index-DHmv5xUB.js";import"./assets/styled-components.browser.esm-DPkS13KC.js";import"react-dom";/**
1
+ import{jsx as e,jsxs as v,Fragment as Ce}from"react/jsx-runtime";import{useMemo as J,useState as C,useRef as Fe,useCallback as j,useEffect as De}from"react";import{message as X,Drawer as be,Modal as fe,Tooltip as pe,Switch as Se,Popover as Me,Badge as Ee,Tag as ze}from"antd";import{u as Le}from"./assets/index-CpW6Dhpp.js";import{k as Ae,J as $,C as _e,F as Ve}from"./assets/index-5gkRuYoC.js";import{c as ue}from"./assets/index--DG-fVvc.js";/* empty css */import{T as Be}from"./assets/index-Cim_5352.js";import Ne from"axios";import{X as me}from"./assets/x-tMUaBf0a.js";import"./assets/styled-components.browser.esm-DPkS13KC.js";import"react-dom";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,4 +18,4 @@ import{jsx as e,jsxs as v,Fragment as Ce}from"react/jsx-runtime";import{useMemo
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const He=ue("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),Ge="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",$e="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42%2022C43.1046%2022%2044%2022.8954%2044%2024V42C44%2043.1046%2043.1046%2044%2042%2044H6C4.89543%2044%204%2043.1046%204%2042V24.0088C4%2022.9042%204.89543%2022.0078%206%2022.0078C7.10457%2022.0078%208%2022.9042%208%2024.0088V40H40V24C40%2022.8954%2040.8954%2022%2042%2022ZM24.0293%204.00195C24.0808%204.00272%2024.1322%204.00504%2024.1836%204.00977C24.1904%204.01042%2024.1973%204.011%2024.2041%204.01172C24.2673%204.01819%2024.3301%204.02757%2024.3926%204.04004C24.3939%204.04031%2024.3952%204.04075%2024.3965%204.04102C24.7693%204.11623%2025.125%204.29691%2025.4141%204.58594L34.4141%2013.5859C35.1951%2014.367%2035.1951%2015.633%2034.4141%2016.4141C33.633%2017.1951%2032.367%2017.1951%2031.5859%2016.4141L25.9922%2010.8203V32C25.9922%2033.1046%2025.0968%2034%2023.9922%2034C22.8876%2034%2021.9922%2033.1046%2021.9922%2032V10.8359L16.4141%2016.4141C15.633%2017.1951%2014.367%2017.1951%2013.5859%2016.4141C12.8049%2015.633%2012.8049%2014.367%2013.5859%2013.5859L22.498%204.67285C22.8016%204.33138%2023.2194%204.09559%2023.6924%204.02441C23.7122%204.02135%2023.732%204.01809%2023.752%204.01562C23.7862%204.01152%2023.8207%204.00919%2023.8555%204.00684C23.8887%204.00446%2023.9218%204.00268%2023.9551%204.00195C23.9674%204.00173%2023.9798%204%2023.9922%204C24.0046%204%2024.0169%204.00173%2024.0293%204.00195Z'%20fill='url(%23paint0_linear_4072_34663)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_4072_34663'%20x1='4'%20y1='-7.25'%20x2='54.4707'%20y2='1.556'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232B69FF'/%3e%3cstop%20offset='1'%20stop-color='%238F91FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",we=({url:a,token:A,role:F,eventsEmit:m})=>{const o=_e.create({baseURL:a,timeout:1e6});return o.interceptors.request.use(t=>{let s=A;return!s&&!["user/login","user/kaptcha","user/regist"].some(l=>t.url.includes(l))?(m&&m("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(t.headers.Authorization=s||"",t.headers.userName=F==="\u672A\u767B\u5F55\u7528\u6237"?"":F,t)}),o.interceptors.response.use(t=>{const s=["user/kaptcha"],i=t.data;if(s.some(L=>t.config.url&&t.config.url.includes(L))||i.size&&i.type)return i;const{success:l,errorMsg:h,errorCode:c}=i;if(l)return i;m&&m("request:error_business",{errorCode:c,errorMsg:h||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:i})},t=>{var s,i,l,h,c,L,p,_,Y;if(t.message==="canceled")return Promise.reject(t);if(m){let q="request:error_network",Z={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:t};((s=t==null?void 0:t.response)==null?void 0:s.status)===401?(q="request:error_auth",Z={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:t,redirect:"/login"}):(((l=(i=t==null?void 0:t.response)==null?void 0:i.data)==null?void 0:l.errorCode)==="30013"||((c=(h=t==null?void 0:t.response)==null?void 0:h.data)==null?void 0:c.errorCode)==="30023")&&(q="request:error_business",Z={errorCode:(p=(L=t==null?void 0:t.response)==null?void 0:L.data)==null?void 0:p.errorCode,errorMsg:((Y=(_=t==null?void 0:t.response)==null?void 0:_.data)==null?void 0:Y.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:t}),m(q,Z)}return Promise.reject(t)}),{getTableList:async t=>{try{const s=await o.get(`/directDB/queryTableList/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableList error:",s)}},getTableTreeList:async t=>{try{const s=await o.get(`/dataTable/queryTableFileTreeList/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableTreeList error:",s)}},getDBDetailById:async(t,s)=>{const i=ge(s);try{const l=await o.get(`/${i}/queryDBInfo/${t}`),{success:h,data:c}=l;if(h)return c}catch(l){console.log("getDBDetailById error:",l)}},delTableById:async(t,s)=>{const i=ge(s);try{const l=await o.delete(`/${i}/deleteTable/${t}`),{success:h,data:c}=l;if(h)return c}catch(l){console.log("delTableById error:",l)}},delFileById:async t=>{try{const s=await o.delete(`/dataTable/deleteTableFileData/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("delFileById",s)}},parseFiles:async({fileIds:t,isGenDescription:s,tableDescriptionMap:i})=>{try{const l=await o.post("/dataTable/parseFiles",{fileIds:t,isGenDescription:s,tableDescriptionMap:i}),{success:h,data:c}=l;if(h)return c}catch(l){console.log("parseFiles error:",l)}},reParseFile:async t=>{try{const s=await o.post(`/dataTable/reParseFile/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("reParseFile error:",s)}},parseAppendFile:async({fileIds:t,tableId:s})=>{try{const i=await o.post("/dataTable/parseAppendFiles",{fileIds:t,tableId:s}),{success:l,data:h}=i;if(l)return h}catch(i){console.log("parseAppendFile error:",i)}},deleteUploadedFiles:async t=>{try{const s=await o.post("/dataTable/cancelUploadFile",{fileIds:t}),{success:i,data:l}=s;if(i)return l}catch(s){console.log("deleteUploadedFiles error:",s)}},getTableInfoById:async t=>{try{const s=await o.get(`/dataTable/queryTableMeta/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableInfoById error:",s)}},updateTableInfo:async({tableId:t,description:s,businessName:i})=>{try{const l=await o.post("/dataTable/updateTableInfo",{tableId:t,businessName:i,description:s}),{success:h,data:c}=l;if(h)return c}catch(l){console.log("updateTableInfo error:",l)}},optimizeDesc:async t=>{try{const s=await o.get(`/genTableDescription/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("optimizeDesc error:",s)}}}},ge=a=>a=="DataTable"?"dataTable":"directDB",re='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',We={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},qe=({drawerTitle:a,drawerVisible:A,handleDrawerClose:F,dbId:m,tableInfo:o,token:k,url:O,role:E})=>{const z=J(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!o,accept:".csv,.xlsx,.xls",maxFiles:o?1:20,url:"http://10.15.12.13:8888/index/database/dataTable/uploadFile",autoUpload:!0,headers:{Authorization:k},queryParams:{databaseId:m,...o&&{tableId:o.tableId}},placeholder:v("div",{children:[e("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),v("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[e("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),e("div",{className:"text-[#888888] font-[12px]",style:{width:"580px"},children:"\u683C\u5F0F\uFF1A.xlsx / .xls / .csv /\uFF08\u7B2C\u4E00\u884C\u662F\u8868\u5934\uFF0C\u5176\u4ED6\u884C\u662F\u6570\u636E\uFF1BCSV \u652F\u6301 UTF-8/GBK/GB2312\u2026\uFF09"}),e("div",{className:"text-[#888888] font-[12px]",children:"\u5355\u6587\u4EF6\u9650\u5236\uFF1A \u226410\u4E07\u884C\uFF0C\u226460\u5217\uFF08\u8D85\u51FA\u81EA\u52A8\u5FFD\u7565\uFF09\uFF1B \u6BCF\u6587\u4EF6 \u22641\u4E2ASheet"}),e("div",{className:"text-[#888888] font-[12px]",children:"\u4E0A\u4F20\u7684\u6587\u4EF6\uFF0C\u5982\u679C\u6709\u4E0D\u7B26\u5408\u6587\u672C\u683C\u5F0F\u7684\u6570\u636E\u7CFB\u7EDF\u81EA\u52A8\u5FFD\u7565"})]})]}),listName:o?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:e("img",{src:$e,width:40}),itemStatus:{pending:e("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:e("span",{style:{fontSize:"12px",color:"#007bff"}}),success:e("span",{style:{fontSize:"12px",color:"#10b981"}}),error:e("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:e(Ue,{size:20,style:{color:"#6b7280"}})}},...!o&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:e("img",{src:Ge}),mode:"text",onClick:()=>{i(!0)}}]},...!o&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[o]),[M,g]=C(!1),[f,U]=C({}),G=Fe(null),[W,R]=C(!1),[B,t]=C([]),[s,i]=C(!1),[l,h]=C(re),[c,L]=C(null),[p,_]=C(re),[Y,q]=C(0),{parseFiles:Z,parseAppendFile:te,deleteUploadedFiles:ae}=we({url:O,token:k,role:E}),K=j(async(d,r,I)=>{var D;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",d,r),d){case"form:ready":r.formRef?G.current=r.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":P();break;case"form_field_change":U(b=>({...b,[r.fieldId]:r.value}));break;case"uploader:error":(D=r.item)!=null&&D.id?t(b=>[{id:r.item.id,status:r.item.status},...b]):X.error(r==null?void 0:r.message);break;case"uploader:success":t(b=>[{id:r.item.id,status:r.item.status},...b]);break;case"uploader:remove":const V=r.item.status;t(b=>b.filter(n=>n.id!==r.item.id)),V=="success"&&await ee([r.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",d)}},[]),se=J(()=>({label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:"form-view",model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:"form-view",type:"form",size:"md",formWidth:z.formWidth,formConfig:{layout:z.layout,showReset:!1,showSubmit:!1,formWidth:z.formWidth,getFormData:()=>({...f,timestamp:new Date().toISOString(),formId:z.id}),onFieldChange:(d,r)=>{K("form_field_change",{fieldId:d,value:r},void 0)},onValidationError:d=>{K("form_validation_error",d,void 0)}}}],dataSource:[{id:z.id,fields:z.fields,defaultValues:{}}],eventsEmit:K,styles:{theme:We}}),[o,z]),P=async()=>{var d;try{g(!0);const r=await G.current.getAllData();if(r.isValid){const I=(d=r.fields.find(D=>D.name=="fileIds"))==null?void 0:d.value;if(Array.isArray(I)&&(I==null?void 0:I.length)>0){let D;if(o)D=await te({fileIds:I.map(V=>V.uploadApiRes),tableId:o.id});else{const V={fileIds:I.map(b=>b.uploadApiRes),tableDescriptionMap:I.reduce((b,n)=>(b[n.uploadApiRes]=n.formData.description,b),{}),isGenDescription:W};D=await Z(V)}D&&F("refresh")}}}catch(r){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",r)}finally{F(),g(!1),R(!1)}},Q=async d=>{var r;try{const I=await G.current.getAllData();if(I.isValid){const D=(r=I.fields.find(V=>V.name=="fileIds"))==null?void 0:r.value;if(D&&Array.isArray(D)&&(D==null?void 0:D.length)>0){const V=D.map(n=>n.uploadApiRes),b=await ee(V)}}}catch(I){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",I)}finally{F(),R(!1)}},ee=async d=>{try{const r=await ae(d);if(r)return r}catch(r){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",r)}},ie=d=>{R(d)},le=j(d=>{h(d),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",d)},[]),ne=j(d=>{L(()=>d),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),oe=j(async()=>{try{if(!c){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const d=c("pure_string");await navigator.clipboard.writeText(d),X.success("\u5DF2\u590D\u5236",1)}catch(d){console.error("\u590D\u5236\u5931\u8D25:",d)}finally{i(!1)}},[c]);return v(Be,{title:a,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:e(me,{size:20,color:"#888888",onClick:()=>Q(),className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:v("div",{className:`flex ${o?"justify-end":"justify-between"} items-center`,children:[!o&&v("div",{className:"flex gap-2 items-center",children:[e("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",e(pe,{title:"\u81EA\u52A8\u751F\u6210\u5F00\u542F\u65F6\u5C06\u57FA\u4E8E\u6570\u636E\u667A\u80FD\u751F\u6210\u63CF\u8FF0\uFF1B\u82E5\u5F00\u542F\u6B64\u529F\u80FD\u5E76\u624B\u52A8\u586B\u5199\u63CF\u8FF0\uFF0C\u5C06\u4F18\u5148\u91C7\u7528\u7528\u6237\u586B\u5199\u7684\u5185\u5BB9\u3002",children:e(Se,{size:14})}),e(ze,{onChange:ie})]}),v("div",{className:"flex self-end gap-3",children:[e($,{mode:"default",label:"\u53D6\u6D88",onClick:Q}),e($,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:M,disabled:B.some(d=>d.status=="error"),onClick:async()=>{await P()}})]})]}),children:[e(be,{...se},"upload-file"),e(fe,{title:v("div",{children:["\u6A21\u7248",e("span",{className:"text-[12px] text-[#888888] ml-[8px]",children:"\u5B8C\u6210\u7F16\u8F91\u540E\uFF0C\u53EF\u5C06\u6587\u672C\u590D\u5236\u7C98\u8D34\u5230\u76F8\u5E94\u63CF\u8FF0\u6846\u4E2D\u3002"})]}),width:672,destroyOnHidden:!0,open:s,onCancel:()=>i(!1),footer:v("div",{className:"flex justify-end items-center gap-3",children:[e($,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{_(re),q(d=>d+1)}}),e($,{mode:"primary",label:"\u590D\u5236",onClick:oe})]}),children:e(Ae,{data:p,onChange:le,onGetData:ne,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},Y)})]})},Ze="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",je="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_4199_8826)'%3e%3cpath%20d='M15.5554%2012.4444C14.9626%2013.0373%2014.6666%2013.6293%2014.6666%2014.2222C14.6666%2014.8151%2014.9626%2015.4071%2015.5554%2016C14.9626%2015.4071%2014.3706%2015.1111%2013.7777%2015.1111C13.1848%2015.1111%2012.5928%2015.4071%2011.9999%2016C12.5928%2015.4071%2012.8888%2014.8151%2012.8888%2014.2222C12.8888%2013.6293%2012.5928%2013.0373%2011.9999%2012.4444C12.5928%2013.0373%2013.1848%2013.3333%2013.7777%2013.3333C14.3706%2013.3333%2014.9626%2013.0373%2015.5554%2012.4444ZM14.6488%204.01778C15.1905%204.55954%2015.4948%205.29431%2015.4948%206.06044C15.4948%206.82658%2015.1905%207.56135%2014.6488%208.10311L7.735%2015.0169C7.46766%2015.2892%207.14901%2015.5058%206.79746%2015.6543C6.44592%2015.8028%206.06844%2015.8801%205.68684%2015.8819C5.30523%2015.8836%204.92706%2015.8097%204.57417%2015.6645C4.22127%2015.5193%203.90065%2015.3056%203.63081%2015.0357C3.36097%2014.7659%203.14727%2014.4453%203.00205%2014.0924C2.85682%2013.7395%202.78295%2013.3613%202.7847%2012.9797C2.78646%2012.5981%202.8638%2012.2206%203.01226%2011.8691C3.16072%2011.5176%203.37736%2011.1989%203.64967%2010.9316L3.95545%2010.6249L3.85145%2010.5244C3.30922%2010.0267%202.76522%209.77778%202.22211%209.77778C1.62923%209.77778%201.03722%2010.0738%200.444336%2010.6667C1.03722%2010.0738%201.33322%209.48178%201.33322%208.88889C1.33322%208.296%201.03722%207.704%200.444336%207.11111C1.03722%207.704%201.62923%208%202.22211%208C2.815%208%203.407%207.704%203.99989%207.11111C3.407%207.704%203.111%208.296%203.111%208.88889C3.111%209.46667%203.39278%2010.0444%203.95545%2010.6222L10.5634%204.01778C11.1052%203.47606%2011.84%203.17173%2012.6061%203.17173C13.3723%203.17173%2014.107%203.47606%2014.6488%204.01778ZM9.55189%206.91378L4.59189%2011.8738C4.30004%2012.1655%204.13603%2012.5612%204.13594%2012.9739C4.1359%2013.1782%204.17611%2013.3806%204.25426%2013.5694C4.33242%2013.7582%204.44699%2013.9297%204.59145%2014.0742C4.7359%2014.2187%204.9074%2014.3334%205.09617%2014.4116C5.28493%2014.4898%205.48725%2014.5301%205.69158%2014.5302C6.10424%2014.5303%206.50004%2014.3664%206.79189%2014.0747L11.7519%209.11378L9.55189%206.91378ZM11.5066%204.96089L10.495%205.97156L12.695%208.17156L13.7057%207.16C13.9846%206.86582%2014.1377%206.47437%2014.1323%206.069C14.1269%205.66364%2013.9635%205.27639%2013.6768%204.98973C13.3902%204.70306%2013.0029%204.53964%2012.5976%204.53425C12.1922%204.52887%2011.8007%204.68194%2011.5066%204.96089ZM9.59545%200C8.85589%200.740444%208.48434%201.48178%208.48434%202.22222C8.48434%202.96267%208.85589%203.704%209.59545%204.44444C8.85589%203.704%208.11456%203.33333%207.37322%203.33333C6.63367%203.33333%205.89234%203.704%205.151%204.44444C5.89234%203.704%206.26211%202.96267%206.26211%202.22222C6.26211%201.48178%205.89322%200.740444%205.15189%200C5.89322%200.740444%206.63456%201.11111%207.37411%201.11111C8.11545%201.11111%208.85678%200.740444%209.59634%200H9.59545Z'%20fill='%23055AFF'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_4199_8826'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",{confirm:Oe}=fe,Ye='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',Xe=({drawerTitle:a,drawerVisible:A,tableInfo:F,handleDrawerClose:m,optimizeDesc:o,eventsEmit:k})=>{const O=J(()=>(F==null?void 0:F.data.find(p=>p.columnId=="name").value)||"-",[F]),[E,z]=C(""),[M,g]=C(null),[f,U]=C(""),[G,W]=C(0),[R,B]=C(!1),[t,s]=C(!1);De(()=>{const p=(F==null?void 0:F.data.find(_=>_.columnId=="description").value)||"-";U(p)},[F]);const i=()=>{Oe({title:"\u4F60\u786E\u5B9A\u8981\u4F7F\u7528\u6A21\u677F\u5417\uFF1F",content:"\u8FD9\u5C06\u66FF\u6362\u4F60\u5F53\u524D\u5DF2\u586B\u5199\u7684\u5185\u5BB9\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002",okText:"\u786E\u8BA4\u66FF\u6362",cancelText:"\u53D6\u6D88",onOk(){U(Ye),W(p=>p+1)},onCancel(){console.log("Cancel")}})},l=j(p=>{z(p),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",p)},[]),h=j(p=>{g(()=>p),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),c=async()=>{try{B(!0);const p=await o(F.tableId);p&&(U(p),W(_=>_+1),B(!1))}catch{X.error("AI \u4F18\u5316\u5931\u8D25")}},L=j(()=>{if(!M){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const p=M("pure_string");k("table_info:update",p)},[M,k]);return v(Be,{title:a,placement:"right",width:720,onClose:m,closeIcon:!1,extra:e(me,{size:20,color:"#888888",onClick:m,className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:e("div",{className:"flex justify-end items-center",children:v("div",{className:"flex self-end gap-3",children:[e($,{mode:"default",label:"\u53D6\u6D88",onClick:m}),e($,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>L(),disabled:R})]})}),children:[e("div",{className:"mb-[10px] font-bold",children:O}),v("div",{className:"mb-[10px]",children:[e("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),e("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),e("span",{className:"text-[#888888] ml-[4px]",children:"(\u8BF7\u51C6\u786E\u586B\u5199\u8868\u683C\u7684\u5E94\u7528\u573A\u666F\u63CF\u8FF0\uFF0C\u5927\u6A21\u578B\u5C06\u4F9D\u8D56\u6B64\u4FE1\u606F\u8BC6\u522B\u5E76\u6B63\u786E\u8C03\u7528\u8BE5\u6570\u636E\u8868\u3002)"})]}),e(Ae,{data:f,onChange:l,onGetData:h,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},G),v("div",{children:[e(Ne,{open:t,onOpenChange:p=>s(!!p),content:e("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:i,className:"hover:bg-gray-100 h-[80px] cursor-pointer rounded",children:"______\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86______\u573A\u666F\u7684\u6570\u636E\uFF0C\u5305\u542B______\u3001______\u3001______\u7B49\u4E3B\u8981\u5B57\u6BB5\uFF0C\u652F\u6301\u7528\u6237\u67E5\u8BE2______\u95EE\u9898(\u5927\u6982\u4ECB\u7ECD)\u5982\u679C\u6D89\u53CA\u591A\u8868\u5173\u8054\u67E5\u8BE2\uFF0C\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7______\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A______\u8868\u683C\u3002"}),title:v("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[e("div",{className:"text-[16px]",children:"\u6A21\u7248"}),e(me,{size:20,color:"#888888",onClick:()=>s(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:p=>p,children:e("span",{children:e($,{mode:"text",icon:e("img",{src:Ze}),children:"\u4F7F\u7528\u6A21\u7248"})})}),e($,{onClick:c,mode:"text",icon:e("img",{src:je}),loading:R,children:"AI\u4F18\u5316"})]})]})},Ke=""+new URL("assets/empty.png",import.meta.url).href;var H=(a=>(a[a.DATE=0]="DATE",a[a.VIEW=1]="VIEW",a[a.ERROR=2]="ERROR",a[a.AUTHORIZE=3]="AUTHORIZE",a[a.DELETE=4]="DELETE",a[a.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",a[a.DOWNLOAD=6]="DOWNLOAD",a[a.EDIT=7]="EDIT",a[a.ADD=8]="ADD",a[a.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",a[a.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",a))(H||{}),ve=(a=>(a.GENERATING="generating",a.SUCCESS="success",a.FAIL="fail",a))(ve||{});const ce={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},Je=a=>typeof a=="string"&&a in ce?ce[a]:ce.default,de=a=>{const{value:A,cell:F}=a;switch(F.columnId){case"importstatus":return A?e(pe,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:e(Ve,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):e(Ce,{});case"status":const m=Je(a.cell.statusType);return A=="\u5BFC\u5165\u5931\u8D25"?e(pe,{title:F.errorMsg,children:v("div",{className:"flex items-center gap-2",children:[e(Ee,{color:m,text:A}),e(xe,{size:14,color:"red"})]})}):e(Ee,{color:m,text:A});default:return e(Ce,{})}},he=[{statusType:"success",value:"\u5BFC\u5165\u6210\u529F",status:"30"},{statusType:"error",value:"\u5BFC\u5165\u5931\u8D25",status:"00"},{statusType:"default",value:"\u5F85\u5BFC\u5165",status:"10"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"20"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"11"}],Pe=a=>{var m,o;const{cell:A,value:F}=a;return typeof F=="string"?e("div",{title:F,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:F}):(m=A.tableMeta)!=null&&m.isGenDescription&&((o=A.tableMeta)==null?void 0:o.generateDescriptionStatus)=="generating"?v("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[e("span",{children:"\u751F\u6210\u4E2D"}),e(Re,{size:14})]}):"-"},Qe=({dbInfo:a,setDrawerTitle:A,setDrawerVisible:F,getBtnDisabled:m})=>v("div",{className:"flex flex-col items-center justify-center h-full",children:[e("div",{className:"text-xl font-semibold mb-3",children:e("img",{src:Ke,width:120})}),e("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),e("div",{className:"flex gap-3",children:e($,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:m&&m(8,a==null?void 0:a.permission),onClick:()=>{A("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),F(!0)}})})]}),{confirm:ye}=fe,mu=a=>{const{url:A,token:F,role:m,id:o,dbType:k,CustomComponents:O,getBtnDisabled:E}=a,[z,M]=C({container:"ready",content:"ready"}),g=Fe(null),f=Fe(null),[U,G]=C(),[W,R]=C({}),[B,t]=C(),[s,i]=C(!1),[l,h]=C(""),[c,L]=C(),[p,_]=C(!1),[Y,q]=C(""),{getTableList:Z,delTableById:te,delFileById:ae,updateTableInfo:K,optimizeDesc:se,getTableTreeList:P,reParseFile:Q,getDBDetailById:ee}=we({url:A,token:F,role:m,eventsEmit:a.eventsEmit});De(()=>(o&&k&&(M(n=>({...n,container:"loading"})),ie()),()=>{f.current&&(clearTimeout(f.current),f.current=null)}),[o,k]);const ie=async()=>{try{const n=await ee(o,k);n&&(t(n),M(u=>({...u,container:"ready",content:"loading"})))}catch(n){console.log("[TableApiError] getDBInfo:",n)}await b()},le=async()=>{try{if(k=="DirectDB"){const n=await Z(o);if(n){const u=oe(n);return G(u||[]),M(w=>({...w,content:"ready"})),u||[]}else M(u=>({...u,content:"error"}))}else{const n=await P(o);if(n){const u=ne(n);return G(u||[]),M(w=>({...w,content:"ready"})),u||[]}else M(u=>({...u,content:"error"}))}}catch(n){console.log("[TableApiError] getTableList:",n)}};function ne(n){return(n||[]).map((u,w)=>{var S,N;let y=he.find(x=>x.status==u.status);const T=u.children.some(x=>x.status=="00");return{id:u.fileId.toString(),tableId:u.tableId,data:[{columnId:"name",value:(u==null?void 0:u.originalFilename)||"-",type:"label"},{columnId:"description",value:(S=u==null?void 0:u.tableMeta)==null?void 0:S.description,type:"customized",tableMeta:u==null?void 0:u.tableMeta},{columnId:"count",value:`${u.rowCount}\u884C\uFF0C${u.columnCount}\u5217`,type:"text"},{columnId:"status",...y,type:"customized",errorMsg:u.errorMsg},{columnId:"importstatus",value:T,type:"customized"},{columnId:"createdAt",value:u.gmtCreate,type:"date"},{columnId:"updatedAt",value:u.gmtModified,type:"date"},...u.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,u.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:E&&E(H.EDIT,u.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:E&&E(H.EDIT,u.permission)}]:[],...u.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action"}]:[],{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",disabled:E&&E(H.DELETE,u.permission)}],expanded:!1,...u.children&&((N=u.children)==null?void 0:N.length)>0&&{children:[...(u.children||[]).map(x=>{const ke=he.find(Te=>Te.status==x.status),Ie=[{columnId:"name",value:x.originalFilename,type:"text"},{columnId:"count",value:`${x.rowCount}\u884C\uFF0C${x.columnCount}\u5217`,type:"text"},{columnId:"status",...ke,errorMsg:x.errorMsg,type:"customized"},{columnId:"createdAt",value:x.gmtCreate,type:"date"},{columnId:"updatedAt",value:x.gmtModified,type:"date"},...x.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,x.permission)}]:[],...x.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:E&&E(H.ADD,x.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:E&&E(H.DELETE,x.permission)}];return{id:x.fileId.toString(),tableId:x.tableId,data:Ie}})]}}})}function oe(n){return(n||[]).map((u,w)=>({id:u.id||Me(8),data:[{columnId:"name",value:u.physicalName},{columnId:"cnname",value:u.businessName},{columnId:"colcount",value:u.columnCount},{columnId:"count",value:`${u.rowCount}\u884C\uFF0C${u.columnCount}\u5217`},{columnId:"actions",value:"view",label:"\u67E5\u770B",disabled:E&&E(H.VIEW,u.permission)}]}))}async function d(n,u,w){switch(console.log("[adopter] mergedEventsEmit",n,u,w),n){case"table_action_delete":{try{ye({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u8BE5\u6570\u636E\u8868\u53CA\u5176\u8FFD\u52A0\u6570\u636E\u90FD\u5C06\u88AB\u5220\u9664\u4E14\u65E0\u6CD5\u6062\u590D",icon:e(xe,{color:"#FF4D4F",className:"mr-[8px]"}),okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await te(u.tableId,k)&&(g!=null&&g.current)&&(g==null||g.current.appFn.removeItem(u.id),X.success("\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"table_action_edit":{q("\u4FEE\u6539\u6570\u636E\u914D\u7F6E"),_(!0),L(u);break}case"toolbar_upload":{h("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),i(!0);break}case"table_action_addData":{h("\u8FFD\u52A0\u6570\u636E"),i(!0),L(u);break}case"table_action_reValidate":{await Q(u.id)&&(f.current&&(clearTimeout(f.current),f.current=null),await b());break}case"table_info:update":{try{if(c!=null&&c.id){const y=(c==null?void 0:c.data.find(S=>S.columnId=="name").value)||"-";if(await K({tableId:c.tableId,description:u,businessName:y})&&(g!=null&&g.current)){const S={...c,data:c.data.map(N=>N.columnId=="description"?{...N,value:u}:N)};g==null||g.current.appFn.updateItem(S,c.id),X.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(y){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",y)}finally{D()}break}case"table_action_delete_sub":{try{ye({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){const{id:y,tableId:T}=u;await ae(u.id)&&(g!=null&&g.current)&&(R(N=>({...N,[T]:[...N[T]||[],y]})),u.data.find(N=>N.status=="00")&&(f.current&&(clearTimeout(f.current),f.current=null),b()),w.removeItem(y,T),X.success("\u8FFD\u52A0\u6587\u4EF6\u6570\u636E\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"toolbar_auth":{typeof a.eventsEmit=="function"&&a.eventsEmit("toolbar_auth",B);break}default:typeof a.eventsEmit=="function"&&a.eventsEmit(n,u);break}}const r=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"direct-table-view",views:[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"direct-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,columns:[{id:"name",title:"\u6570\u636E\u8868\u82F1\u6587\u540D\u79F0",type:"label"},{id:"cnname",title:"\u6570\u636E\u8868\u4E2D\u6587\u540D\u79F0",type:"label"},{id:"colcount",title:"\u5B57\u6BB5\u6570",type:"text"},{id:"count",title:"\u6570\u636E\u91CF",type:"text"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description"],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}]}),[U,k]),I=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"data-table-view",views:[{label:"\u4E0A\u4F20\u6570\u636E\u5217\u8868",id:"data-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"name",title:"\u6587\u4EF6\u540D",type:"label",tip:"\u6587\u4EF6\u540D"},{id:"description",title:"\u63CF\u8FF0",type:"customized",component:e(Pe,{}),helpText:"\u6253\u5F00\u81EA\u52A8\u751F\u6210\u63CF\u8FF0\u5F00\u5173\u540E\uFF0C\u82E5\u63CF\u8FF0\u672A\u6B63\u5E38\u751F\u6210\uFF0C\u5219\u63CF\u8FF0\u5185\u5BB9\u4E3A\u7A7A\uFF0C\u5982\u60A8\u4ECD\u7136\u9700\u8981\u63CF\u8FF0\uFF0C\u5219\u9700\u8981\u624B\u52A8\u6DFB\u52A0"},{id:"count",title:"\u6570\u636E\u91CF",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",component:e(de,{})},{id:"importstatus",title:"\u8FFD\u52A0\u63D0\u793A",type:"customized",component:e(de,{})},{id:"createdAt",title:"\u521B\u5EFA\u65F6\u95F4",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{id:"updatedAt",title:"\u66F4\u65B0\u65F6\u95F4",type:"date",tip:"\u66F4\u65B0\u65F6\u95F4"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"button",key:"upload",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",btnType:"primary",disabled:E&&E(H.ADD,B==null?void 0:B.permission),icon:e(He,{size:12})},{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description",["name"]],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}],subTableConfig:{type:"table",allowMultiSelect:!1,viewBehavior:"pagination",viewPageSize:5,columns:[{title:"\u8FFD\u52A0\u6587\u4EF6\u540D",id:"name",type:"text",tip:"\u8FFD\u52A0\u6587\u4EF6\u540D"},{title:"\u6570\u636E\u91CF",id:"count",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",tip:"\u5BFC\u5165\u72B6\u6001",component:e(de,{})},{title:"\u521B\u5EFA\u65F6\u95F4",id:"createdAt",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{title:"\u66F4\u6539\u65F6\u95F4",id:"updatedAt",type:"date",tip:"\u66F4\u6539\u65F6\u95F4"},{title:"\u64CD\u4F5C",id:"actions",type:"action"}]},subTablePendingIds:W,onSubTableRowAnimationComplete:(n,u)=>{R(w=>({...w,[n]:(w[n]||[]).filter(y=>y!==u)}))}}),[W,U,k,B]),D=n=>{i(!1),_(!1),L(void 0),n=="refresh"&&(f.current&&(clearTimeout(f.current),f.current=null),b())};function V(n){var u;if(!Array.isArray(n))return!0;for(const w of n){if(w.data){const y=w.data.find(S=>S.columnId==="status"),T=w.data.find(S=>S.columnId==="description");if(y&&(y.status==="20"||y.status==="11"||((u=T==null?void 0:T.tableMeta)==null?void 0:u.generateDescriptionStatus)==ve.GENERATING))return!1}if(Array.isArray(w.children)){for(const y of w.children)if(y.data){const T=y.data.find(S=>S.columnId==="status");if(T&&(T.status==="20"||T.status==="11"))return!1}}}return!0}const b=async()=>{const n=await le();V(n||[])?f.current&&(clearTimeout(f.current),f.current=null):(f.current&&(clearTimeout(f.current),f.current=null),f.current=setTimeout(()=>{b()},5e3))};return v(Le,{title:B==null?void 0:B.name,description:(B==null?void 0:B.description)||"-",goBack:()=>{var n;(n=a.eventsEmit)==null||n.call(a,"goBack",{})},children:[e(be,{dataSource:U,ref:g,eventsEmit:d,status:z,CustomComponents:{EmptyData:()=>e(Qe,{dbInfo:B,setDrawerTitle:h,setDrawerVisible:i,getBtnDisabled:E}),...O},...k=="DataTable"?I:r}),e(qe,{drawerTitle:l,drawerVisible:s,handleDrawerClose:D,dbId:o,token:F,url:A,role:m,tableInfo:c}),e(Xe,{drawerTitle:Y,drawerVisible:p,handleDrawerClose:D,tableInfo:c,optimizeDesc:se,eventsEmit:d})]})};export{mu as default};
21
+ */const He=ue("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),Ge="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",$e="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42%2022C43.1046%2022%2044%2022.8954%2044%2024V42C44%2043.1046%2043.1046%2044%2042%2044H6C4.89543%2044%204%2043.1046%204%2042V24.0088C4%2022.9042%204.89543%2022.0078%206%2022.0078C7.10457%2022.0078%208%2022.9042%208%2024.0088V40H40V24C40%2022.8954%2040.8954%2022%2042%2022ZM24.0293%204.00195C24.0808%204.00272%2024.1322%204.00504%2024.1836%204.00977C24.1904%204.01042%2024.1973%204.011%2024.2041%204.01172C24.2673%204.01819%2024.3301%204.02757%2024.3926%204.04004C24.3939%204.04031%2024.3952%204.04075%2024.3965%204.04102C24.7693%204.11623%2025.125%204.29691%2025.4141%204.58594L34.4141%2013.5859C35.1951%2014.367%2035.1951%2015.633%2034.4141%2016.4141C33.633%2017.1951%2032.367%2017.1951%2031.5859%2016.4141L25.9922%2010.8203V32C25.9922%2033.1046%2025.0968%2034%2023.9922%2034C22.8876%2034%2021.9922%2033.1046%2021.9922%2032V10.8359L16.4141%2016.4141C15.633%2017.1951%2014.367%2017.1951%2013.5859%2016.4141C12.8049%2015.633%2012.8049%2014.367%2013.5859%2013.5859L22.498%204.67285C22.8016%204.33138%2023.2194%204.09559%2023.6924%204.02441C23.7122%204.02135%2023.732%204.01809%2023.752%204.01562C23.7862%204.01152%2023.8207%204.00919%2023.8555%204.00684C23.8887%204.00446%2023.9218%204.00268%2023.9551%204.00195C23.9674%204.00173%2023.9798%204%2023.9922%204C24.0046%204%2024.0169%204.00173%2024.0293%204.00195Z'%20fill='url(%23paint0_linear_4072_34663)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_4072_34663'%20x1='4'%20y1='-7.25'%20x2='54.4707'%20y2='1.556'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232B69FF'/%3e%3cstop%20offset='1'%20stop-color='%238F91FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",we=({url:a,token:A,role:F,eventsEmit:m})=>{const o=Ne.create({baseURL:a,timeout:1e6});return o.interceptors.request.use(t=>{let s=A;return!s&&!["user/login","user/kaptcha","user/regist"].some(l=>t.url.includes(l))?(m&&m("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(t.headers.Authorization=s||"",t.headers.userName=F==="\u672A\u767B\u5F55\u7528\u6237"?"":F,t)}),o.interceptors.response.use(t=>{const s=["user/kaptcha"],i=t.data;if(s.some(L=>t.config.url&&t.config.url.includes(L))||i.size&&i.type)return i;const{success:l,errorMsg:h,errorCode:c}=i;if(l)return i;m&&m("request:error_business",{errorCode:c,errorMsg:h||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:i})},t=>{var s,i,l,h,c,L,p,_,Y;if(t.message==="canceled")return Promise.reject(t);if(m){let q="request:error_network",Z={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:t};((s=t==null?void 0:t.response)==null?void 0:s.status)===401?(q="request:error_auth",Z={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:t,redirect:"/login"}):(((l=(i=t==null?void 0:t.response)==null?void 0:i.data)==null?void 0:l.errorCode)==="30013"||((c=(h=t==null?void 0:t.response)==null?void 0:h.data)==null?void 0:c.errorCode)==="30023")&&(q="request:error_business",Z={errorCode:(p=(L=t==null?void 0:t.response)==null?void 0:L.data)==null?void 0:p.errorCode,errorMsg:((Y=(_=t==null?void 0:t.response)==null?void 0:_.data)==null?void 0:Y.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:t}),m(q,Z)}return Promise.reject(t)}),{getTableList:async t=>{try{const s=await o.get(`/directDB/queryTableList/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableList error:",s)}},getTableTreeList:async t=>{try{const s=await o.get(`/dataTable/queryTableFileTreeList/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableTreeList error:",s)}},getDBDetailById:async(t,s)=>{const i=ge(s);try{const l=await o.get(`/${i}/queryDBInfo/${t}`),{success:h,data:c}=l;if(h)return c}catch(l){console.log("getDBDetailById error:",l)}},delTableById:async(t,s)=>{const i=ge(s);try{const l=await o.delete(`/${i}/deleteTable/${t}`),{success:h,data:c}=l;if(h)return c}catch(l){console.log("delTableById error:",l)}},delFileById:async t=>{try{const s=await o.delete(`/dataTable/deleteTableFileData/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("delFileById",s)}},parseFiles:async({fileIds:t,isGenDescription:s,tableDescriptionMap:i})=>{try{const l=await o.post("/dataTable/parseFiles",{fileIds:t,isGenDescription:s,tableDescriptionMap:i}),{success:h,data:c}=l;if(h)return c}catch(l){console.log("parseFiles error:",l)}},reParseFile:async t=>{try{const s=await o.post(`/dataTable/reParseFile/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("reParseFile error:",s)}},parseAppendFile:async({fileIds:t,tableId:s})=>{try{const i=await o.post("/dataTable/parseAppendFiles",{fileIds:t,tableId:s}),{success:l,data:h}=i;if(l)return h}catch(i){console.log("parseAppendFile error:",i)}},deleteUploadedFiles:async t=>{try{const s=await o.post("/dataTable/cancelUploadFile",{fileIds:t}),{success:i,data:l}=s;if(i)return l}catch(s){console.log("deleteUploadedFiles error:",s)}},getTableInfoById:async t=>{try{const s=await o.get(`/dataTable/queryTableMeta/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableInfoById error:",s)}},updateTableInfo:async({tableId:t,description:s,businessName:i})=>{try{const l=await o.post("/dataTable/updateTableInfo",{tableId:t,businessName:i,description:s}),{success:h,data:c}=l;if(h)return c}catch(l){console.log("updateTableInfo error:",l)}},optimizeDesc:async t=>{try{const s=await o.get(`/genTableDescription/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("optimizeDesc error:",s)}}}},ge=a=>a=="DataTable"?"dataTable":"directDB",re='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',We={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},qe=({drawerTitle:a,drawerVisible:A,handleDrawerClose:F,dbId:m,tableInfo:o,token:k,url:O,role:E})=>{const z=J(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!o,accept:".csv,.xlsx,.xls",maxFiles:o?1:20,url:"http://10.15.12.13:8888/index/database/dataTable/uploadFile",autoUpload:!0,headers:{Authorization:k},queryParams:{databaseId:m,...o&&{tableId:o.tableId}},placeholder:v("div",{children:[e("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),v("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[e("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),e("div",{className:"text-[#888888] font-[12px]",style:{width:"580px"},children:"\u683C\u5F0F\uFF1A.xlsx / .xls / .csv /\uFF08\u7B2C\u4E00\u884C\u662F\u8868\u5934\uFF0C\u5176\u4ED6\u884C\u662F\u6570\u636E\uFF1BCSV \u652F\u6301 UTF-8/GBK/GB2312\u2026\uFF09"}),e("div",{className:"text-[#888888] font-[12px]",children:"\u5355\u6587\u4EF6\u9650\u5236\uFF1A \u226410\u4E07\u884C\uFF0C\u226460\u5217\uFF08\u8D85\u51FA\u81EA\u52A8\u5FFD\u7565\uFF09\uFF1B \u6BCF\u6587\u4EF6 \u22641\u4E2ASheet"}),e("div",{className:"text-[#888888] font-[12px]",children:"\u4E0A\u4F20\u7684\u6587\u4EF6\uFF0C\u5982\u679C\u6709\u4E0D\u7B26\u5408\u6587\u672C\u683C\u5F0F\u7684\u6570\u636E\u7CFB\u7EDF\u81EA\u52A8\u5FFD\u7565"})]})]}),listName:o?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:e("img",{src:$e,width:40}),itemStatus:{pending:e("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:e("span",{style:{fontSize:"12px",color:"#007bff"}}),success:e("span",{style:{fontSize:"12px",color:"#10b981"}}),error:e("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:e(Ue,{size:20,style:{color:"#6b7280"}})}},...!o&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:e("img",{src:Ge}),mode:"text",onClick:()=>{i(!0)}}]},...!o&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[o]),[S,g]=C(!1),[f,U]=C({}),G=Fe(null),[W,R]=C(!1),[B,t]=C([]),[s,i]=C(!1),[l,h]=C(re),[c,L]=C(null),[p,_]=C(re),[Y,q]=C(0),{parseFiles:Z,parseAppendFile:te,deleteUploadedFiles:ae}=we({url:O,token:k,role:E}),K=j(async(d,r,I)=>{var D;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",d,r),d){case"form:ready":r.formRef?G.current=r.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":P();break;case"form_field_change":U(b=>({...b,[r.fieldId]:r.value}));break;case"uploader:error":(D=r.item)!=null&&D.id?t(b=>[{id:r.item.id,status:r.item.status},...b]):X.error(r==null?void 0:r.message);break;case"uploader:success":t(b=>[{id:r.item.id,status:r.item.status},...b]);break;case"uploader:remove":const V=r.item.status;t(b=>b.filter(n=>n.id!==r.item.id)),V=="success"&&await ee([r.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",d)}},[]),se=J(()=>({label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:"form-view",model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:"form-view",type:"form",size:"md",formWidth:z.formWidth,formConfig:{layout:z.layout,showReset:!1,showSubmit:!1,formWidth:z.formWidth,getFormData:()=>({...f,timestamp:new Date().toISOString(),formId:z.id}),onFieldChange:(d,r)=>{K("form_field_change",{fieldId:d,value:r},void 0)},onValidationError:d=>{K("form_validation_error",d,void 0)}}}],dataSource:[{id:z.id,fields:z.fields,defaultValues:{}}],eventsEmit:K,styles:{theme:We}}),[o,z]),P=async()=>{var d;try{g(!0);const r=await G.current.getAllData();if(r.isValid){const I=(d=r.fields.find(D=>D.name=="fileIds"))==null?void 0:d.value;if(Array.isArray(I)&&(I==null?void 0:I.length)>0){let D;if(o)D=await te({fileIds:I.map(V=>V.uploadApiRes),tableId:o.id});else{const V={fileIds:I.map(b=>b.uploadApiRes),tableDescriptionMap:I.reduce((b,n)=>(b[n.uploadApiRes]=n.formData.description,b),{}),isGenDescription:W};D=await Z(V)}D&&F("refresh")}}}catch(r){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",r)}finally{F(),g(!1),R(!1)}},Q=async d=>{var r;try{const I=await G.current.getAllData();if(I.isValid){const D=(r=I.fields.find(V=>V.name=="fileIds"))==null?void 0:r.value;if(D&&Array.isArray(D)&&(D==null?void 0:D.length)>0){const V=D.map(n=>n.uploadApiRes),b=await ee(V)}}}catch(I){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",I)}finally{F(),R(!1)}},ee=async d=>{try{const r=await ae(d);if(r)return r}catch(r){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",r)}},ie=d=>{R(d)},le=j(d=>{h(d),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",d)},[]),ne=j(d=>{L(()=>d),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),oe=j(async()=>{try{if(!c){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const d=c("pure_string");await navigator.clipboard.writeText(d),X.success("\u5DF2\u590D\u5236",1)}catch(d){console.error("\u590D\u5236\u5931\u8D25:",d)}finally{i(!1)}},[c]);return v(be,{title:a,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:e(me,{size:20,color:"#888888",onClick:()=>Q(),className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:v("div",{className:`flex ${o?"justify-end":"justify-between"} items-center`,children:[!o&&v("div",{className:"flex gap-2 items-center",children:[e("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",e(pe,{title:"\u81EA\u52A8\u751F\u6210\u5F00\u542F\u65F6\u5C06\u57FA\u4E8E\u6570\u636E\u667A\u80FD\u751F\u6210\u63CF\u8FF0\uFF1B\u82E5\u5F00\u542F\u6B64\u529F\u80FD\u5E76\u624B\u52A8\u586B\u5199\u63CF\u8FF0\uFF0C\u5C06\u4F18\u5148\u91C7\u7528\u7528\u6237\u586B\u5199\u7684\u5185\u5BB9\u3002",children:e(_e,{size:14})}),e(Se,{onChange:ie})]}),v("div",{className:"flex self-end gap-3",children:[e($,{mode:"default",label:"\u53D6\u6D88",onClick:Q}),e($,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:S,disabled:B.some(d=>d.status=="error"),onClick:async()=>{await P()}})]})]}),children:[e(Ae,{...se},"upload-file"),e(fe,{title:v("div",{children:["\u6A21\u7248",e("span",{className:"text-[12px] text-[#888888] ml-[8px]",children:"\u5B8C\u6210\u7F16\u8F91\u540E\uFF0C\u53EF\u5C06\u6587\u672C\u590D\u5236\u7C98\u8D34\u5230\u76F8\u5E94\u63CF\u8FF0\u6846\u4E2D\u3002"})]}),width:672,destroyOnHidden:!0,open:s,onCancel:()=>i(!1),footer:v("div",{className:"flex justify-end items-center gap-3",children:[e($,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{_(re),q(d=>d+1)}}),e($,{mode:"primary",label:"\u590D\u5236",onClick:oe})]}),children:e(Be,{data:p,onChange:le,onGetData:ne,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},Y)})]})},Ze="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",je="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_4199_8826)'%3e%3cpath%20d='M15.5554%2012.4444C14.9626%2013.0373%2014.6666%2013.6293%2014.6666%2014.2222C14.6666%2014.8151%2014.9626%2015.4071%2015.5554%2016C14.9626%2015.4071%2014.3706%2015.1111%2013.7777%2015.1111C13.1848%2015.1111%2012.5928%2015.4071%2011.9999%2016C12.5928%2015.4071%2012.8888%2014.8151%2012.8888%2014.2222C12.8888%2013.6293%2012.5928%2013.0373%2011.9999%2012.4444C12.5928%2013.0373%2013.1848%2013.3333%2013.7777%2013.3333C14.3706%2013.3333%2014.9626%2013.0373%2015.5554%2012.4444ZM14.6488%204.01778C15.1905%204.55954%2015.4948%205.29431%2015.4948%206.06044C15.4948%206.82658%2015.1905%207.56135%2014.6488%208.10311L7.735%2015.0169C7.46766%2015.2892%207.14901%2015.5058%206.79746%2015.6543C6.44592%2015.8028%206.06844%2015.8801%205.68684%2015.8819C5.30523%2015.8836%204.92706%2015.8097%204.57417%2015.6645C4.22127%2015.5193%203.90065%2015.3056%203.63081%2015.0357C3.36097%2014.7659%203.14727%2014.4453%203.00205%2014.0924C2.85682%2013.7395%202.78295%2013.3613%202.7847%2012.9797C2.78646%2012.5981%202.8638%2012.2206%203.01226%2011.8691C3.16072%2011.5176%203.37736%2011.1989%203.64967%2010.9316L3.95545%2010.6249L3.85145%2010.5244C3.30922%2010.0267%202.76522%209.77778%202.22211%209.77778C1.62923%209.77778%201.03722%2010.0738%200.444336%2010.6667C1.03722%2010.0738%201.33322%209.48178%201.33322%208.88889C1.33322%208.296%201.03722%207.704%200.444336%207.11111C1.03722%207.704%201.62923%208%202.22211%208C2.815%208%203.407%207.704%203.99989%207.11111C3.407%207.704%203.111%208.296%203.111%208.88889C3.111%209.46667%203.39278%2010.0444%203.95545%2010.6222L10.5634%204.01778C11.1052%203.47606%2011.84%203.17173%2012.6061%203.17173C13.3723%203.17173%2014.107%203.47606%2014.6488%204.01778ZM9.55189%206.91378L4.59189%2011.8738C4.30004%2012.1655%204.13603%2012.5612%204.13594%2012.9739C4.1359%2013.1782%204.17611%2013.3806%204.25426%2013.5694C4.33242%2013.7582%204.44699%2013.9297%204.59145%2014.0742C4.7359%2014.2187%204.9074%2014.3334%205.09617%2014.4116C5.28493%2014.4898%205.48725%2014.5301%205.69158%2014.5302C6.10424%2014.5303%206.50004%2014.3664%206.79189%2014.0747L11.7519%209.11378L9.55189%206.91378ZM11.5066%204.96089L10.495%205.97156L12.695%208.17156L13.7057%207.16C13.9846%206.86582%2014.1377%206.47437%2014.1323%206.069C14.1269%205.66364%2013.9635%205.27639%2013.6768%204.98973C13.3902%204.70306%2013.0029%204.53964%2012.5976%204.53425C12.1922%204.52887%2011.8007%204.68194%2011.5066%204.96089ZM9.59545%200C8.85589%200.740444%208.48434%201.48178%208.48434%202.22222C8.48434%202.96267%208.85589%203.704%209.59545%204.44444C8.85589%203.704%208.11456%203.33333%207.37322%203.33333C6.63367%203.33333%205.89234%203.704%205.151%204.44444C5.89234%203.704%206.26211%202.96267%206.26211%202.22222C6.26211%201.48178%205.89322%200.740444%205.15189%200C5.89322%200.740444%206.63456%201.11111%207.37411%201.11111C8.11545%201.11111%208.85678%200.740444%209.59634%200H9.59545Z'%20fill='%23055AFF'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_4199_8826'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",{confirm:Oe}=fe,Ye='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',Xe=({drawerTitle:a,drawerVisible:A,tableInfo:F,handleDrawerClose:m,optimizeDesc:o,eventsEmit:k})=>{const O=J(()=>(F==null?void 0:F.data.find(p=>p.columnId=="name").value)||"-",[F]),[E,z]=C(""),[S,g]=C(null),[f,U]=C(""),[G,W]=C(0),[R,B]=C(!1),[t,s]=C(!1);De(()=>{const p=(F==null?void 0:F.data.find(_=>_.columnId=="description").value)||"-";U(p)},[F]);const i=()=>{Oe({title:"\u4F60\u786E\u5B9A\u8981\u4F7F\u7528\u6A21\u677F\u5417\uFF1F",content:"\u8FD9\u5C06\u66FF\u6362\u4F60\u5F53\u524D\u5DF2\u586B\u5199\u7684\u5185\u5BB9\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002",okText:"\u786E\u8BA4\u66FF\u6362",cancelText:"\u53D6\u6D88",onOk(){U(Ye),W(p=>p+1)},onCancel(){console.log("Cancel")}})},l=j(p=>{z(p),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",p)},[]),h=j(p=>{g(()=>p),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),c=async()=>{try{B(!0);const p=await o(F.tableId);p&&(U(p),W(_=>_+1),B(!1))}catch{X.error("AI \u4F18\u5316\u5931\u8D25")}},L=j(()=>{if(!S){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const p=S("pure_string");k("table_info:update",p)},[S,k]);return v(be,{title:a,placement:"right",width:720,onClose:m,closeIcon:!1,extra:e(me,{size:20,color:"#888888",onClick:m,className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:e("div",{className:"flex justify-end items-center",children:v("div",{className:"flex self-end gap-3",children:[e($,{mode:"default",label:"\u53D6\u6D88",onClick:m}),e($,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>L(),disabled:R})]})}),children:[e("div",{className:"mb-[10px] font-bold",children:O}),v("div",{className:"mb-[10px]",children:[e("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),e("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),e("span",{className:"text-[#888888] ml-[4px]",children:"(\u8BF7\u51C6\u786E\u586B\u5199\u8868\u683C\u7684\u5E94\u7528\u573A\u666F\u63CF\u8FF0\uFF0C\u5927\u6A21\u578B\u5C06\u4F9D\u8D56\u6B64\u4FE1\u606F\u8BC6\u522B\u5E76\u6B63\u786E\u8C03\u7528\u8BE5\u6570\u636E\u8868\u3002)"})]}),e(Be,{data:f,onChange:l,onGetData:h,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},G),v("div",{children:[e(Me,{open:t,onOpenChange:p=>s(!!p),content:e("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:i,className:"hover:bg-gray-100 h-[80px] cursor-pointer rounded",children:"______\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86______\u573A\u666F\u7684\u6570\u636E\uFF0C\u5305\u542B______\u3001______\u3001______\u7B49\u4E3B\u8981\u5B57\u6BB5\uFF0C\u652F\u6301\u7528\u6237\u67E5\u8BE2______\u95EE\u9898(\u5927\u6982\u4ECB\u7ECD)\u5982\u679C\u6D89\u53CA\u591A\u8868\u5173\u8054\u67E5\u8BE2\uFF0C\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7______\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A______\u8868\u683C\u3002"}),title:v("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[e("div",{className:"text-[16px]",children:"\u6A21\u7248"}),e(me,{size:20,color:"#888888",onClick:()=>s(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:p=>p,children:e("span",{children:e($,{mode:"text",icon:e("img",{src:Ze}),children:"\u4F7F\u7528\u6A21\u7248"})})}),e($,{onClick:c,mode:"text",icon:e("img",{src:je}),loading:R,children:"AI\u4F18\u5316"})]})]})},Ke=""+new URL("assets/empty.png",import.meta.url).href;var H=(a=>(a[a.DATE=0]="DATE",a[a.VIEW=1]="VIEW",a[a.ERROR=2]="ERROR",a[a.AUTHORIZE=3]="AUTHORIZE",a[a.DELETE=4]="DELETE",a[a.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",a[a.DOWNLOAD=6]="DOWNLOAD",a[a.EDIT=7]="EDIT",a[a.ADD=8]="ADD",a[a.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",a[a.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",a))(H||{}),ve=(a=>(a.GENERATING="generating",a.SUCCESS="success",a.FAIL="fail",a))(ve||{});const ce={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},Je=a=>typeof a=="string"&&a in ce?ce[a]:ce.default,de=a=>{const{value:A,cell:F}=a;switch(F.columnId){case"importstatus":return A?e(pe,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:e(ze,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):e(Ce,{});case"status":const m=Je(a.cell.statusType);return A=="\u5BFC\u5165\u5931\u8D25"?e(pe,{title:F.errorMsg,children:v("div",{className:"flex items-center gap-2",children:[e(Ee,{color:m,text:A}),e(xe,{size:14,color:"red"})]})}):e(Ee,{color:m,text:A});default:return e(Ce,{})}},he=[{statusType:"success",value:"\u5BFC\u5165\u6210\u529F",status:"30"},{statusType:"error",value:"\u5BFC\u5165\u5931\u8D25",status:"00"},{statusType:"default",value:"\u5F85\u5BFC\u5165",status:"10"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"20"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"11"}],Pe=a=>{var m,o;const{cell:A,value:F}=a;return typeof F=="string"?e("div",{title:F,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:F}):(m=A.tableMeta)!=null&&m.isGenDescription&&((o=A.tableMeta)==null?void 0:o.generateDescriptionStatus)=="generating"?v("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[e("span",{children:"\u751F\u6210\u4E2D"}),e(Re,{size:14})]}):"-"},Qe=({dbInfo:a,setDrawerTitle:A,setDrawerVisible:F,getBtnDisabled:m})=>v("div",{className:"flex flex-col items-center justify-center h-full",children:[e("div",{className:"text-xl font-semibold mb-3",children:e("img",{src:Ke,width:120})}),e("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),e("div",{className:"flex gap-3",children:e($,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:m&&m(8,a==null?void 0:a.permission),onClick:()=>{A("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),F(!0)}})})]}),{confirm:ye}=fe,Fu=a=>{const{url:A,token:F,role:m,id:o,dbType:k,CustomComponents:O,getBtnDisabled:E}=a,[z,S]=C({container:"ready",content:"ready"}),g=Fe(null),f=Fe(null),[U,G]=C(),[W,R]=C({}),[B,t]=C(),[s,i]=C(!1),[l,h]=C(""),[c,L]=C(),[p,_]=C(!1),[Y,q]=C(""),{getTableList:Z,delTableById:te,delFileById:ae,updateTableInfo:K,optimizeDesc:se,getTableTreeList:P,reParseFile:Q,getDBDetailById:ee}=we({url:A,token:F,role:m,eventsEmit:a.eventsEmit});De(()=>(o&&k&&(S(n=>({...n,container:"loading"})),ie()),()=>{f.current&&(clearTimeout(f.current),f.current=null)}),[o,k]);const ie=async()=>{try{const n=await ee(o,k);n&&(t(n),S(u=>({...u,container:"ready",content:"loading"})))}catch(n){console.log("[TableApiError] getDBInfo:",n)}await b()},le=async()=>{try{if(k=="DirectDB"){const n=await Z(o);if(n){const u=oe(n);return G(u||[]),S(w=>({...w,content:"ready"})),u||[]}else S(u=>({...u,content:"error"}))}else{const n=await P(o);if(n){const u=ne(n);return G(u||[]),S(w=>({...w,content:"ready"})),u||[]}else S(u=>({...u,content:"error"}))}}catch(n){console.log("[TableApiError] getTableList:",n)}};function ne(n){return(n||[]).map((u,w)=>{var M,N;let y=he.find(x=>x.status==u.status);const T=u.children.some(x=>x.status=="00");return{id:u.fileId.toString(),tableId:u.tableId,data:[{columnId:"name",value:(u==null?void 0:u.originalFilename)||"-",type:"label"},{columnId:"description",value:(M=u==null?void 0:u.tableMeta)==null?void 0:M.description,type:"customized",tableMeta:u==null?void 0:u.tableMeta},{columnId:"count",value:`${u.rowCount}\u884C\uFF0C${u.columnCount}\u5217`,type:"text"},{columnId:"status",...y,type:"customized",errorMsg:u.errorMsg},{columnId:"importstatus",value:T,type:"customized"},{columnId:"createdAt",value:u.gmtCreate,type:"date"},{columnId:"updatedAt",value:u.gmtModified,type:"date"},...u.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,u.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:E&&E(H.EDIT,u.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:E&&E(H.EDIT,u.permission)}]:[],...u.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action"}]:[],{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",disabled:E&&E(H.DELETE,u.permission)}],expanded:!1,...u.children&&((N=u.children)==null?void 0:N.length)>0&&{children:[...(u.children||[]).map(x=>{const ke=he.find(Te=>Te.status==x.status),Ie=[{columnId:"name",value:x.originalFilename,type:"text"},{columnId:"count",value:`${x.rowCount}\u884C\uFF0C${x.columnCount}\u5217`,type:"text"},{columnId:"status",...ke,errorMsg:x.errorMsg,type:"customized"},{columnId:"createdAt",value:x.gmtCreate,type:"date"},{columnId:"updatedAt",value:x.gmtModified,type:"date"},...x.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,x.permission)}]:[],...x.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:E&&E(H.ADD,x.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:E&&E(H.DELETE,x.permission)}];return{id:x.fileId.toString(),tableId:x.tableId,data:Ie}})]}}})}function oe(n){return(n||[]).map((u,w)=>({id:u.id||Le(8),data:[{columnId:"name",value:u.physicalName},{columnId:"cnname",value:u.businessName},{columnId:"colcount",value:u.columnCount},{columnId:"count",value:`${u.rowCount}\u884C\uFF0C${u.columnCount}\u5217`},{columnId:"actions",value:"view",label:"\u67E5\u770B",disabled:E&&E(H.VIEW,u.permission)}]}))}async function d(n,u,w){switch(console.log("[adopter] mergedEventsEmit",n,u,w),n){case"table_action_delete":{try{ye({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u8BE5\u6570\u636E\u8868\u53CA\u5176\u8FFD\u52A0\u6570\u636E\u90FD\u5C06\u88AB\u5220\u9664\u4E14\u65E0\u6CD5\u6062\u590D",icon:e(xe,{color:"#FF4D4F",className:"mr-[8px]"}),okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await te(u.tableId,k)&&(g!=null&&g.current)&&(g==null||g.current.appFn.removeItem(u.id),X.success("\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"table_action_edit":{q("\u4FEE\u6539\u6570\u636E\u914D\u7F6E"),_(!0),L(u);break}case"toolbar_upload":{h("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),i(!0);break}case"table_action_addData":{h("\u8FFD\u52A0\u6570\u636E"),i(!0),L(u);break}case"table_action_reValidate":{await Q(u.id)&&(f.current&&(clearTimeout(f.current),f.current=null),await b());break}case"table_info:update":{try{if(c!=null&&c.id){const y=(c==null?void 0:c.data.find(M=>M.columnId=="name").value)||"-";if(await K({tableId:c.tableId,description:u,businessName:y})&&(g!=null&&g.current)){const M={...c,data:c.data.map(N=>N.columnId=="description"?{...N,value:u}:N)};g==null||g.current.appFn.updateItem(M,c.id),X.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(y){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",y)}finally{D()}break}case"table_action_delete_sub":{try{ye({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){const{id:y,tableId:T}=u;await ae(u.id)&&(g!=null&&g.current)&&(R(N=>({...N,[T]:[...N[T]||[],y]})),u.data.find(N=>N.status=="00")&&(f.current&&(clearTimeout(f.current),f.current=null),b()),w.removeItem(y,T),X.success("\u8FFD\u52A0\u6587\u4EF6\u6570\u636E\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"toolbar_auth":{typeof a.eventsEmit=="function"&&a.eventsEmit("toolbar_auth",B);break}default:typeof a.eventsEmit=="function"&&a.eventsEmit(n,u);break}}const r=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"direct-table-view",views:[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"direct-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,columns:[{id:"name",title:"\u6570\u636E\u8868\u82F1\u6587\u540D\u79F0",type:"label"},{id:"cnname",title:"\u6570\u636E\u8868\u4E2D\u6587\u540D\u79F0",type:"label"},{id:"colcount",title:"\u5B57\u6BB5\u6570",type:"text"},{id:"count",title:"\u6570\u636E\u91CF",type:"text"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description"],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}]}),[U,k]),I=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"data-table-view",views:[{label:"\u4E0A\u4F20\u6570\u636E\u5217\u8868",id:"data-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"name",title:"\u6587\u4EF6\u540D",type:"label",tip:"\u6587\u4EF6\u540D"},{id:"description",title:"\u63CF\u8FF0",type:"customized",component:e(Pe,{}),helpText:"\u6253\u5F00\u81EA\u52A8\u751F\u6210\u63CF\u8FF0\u5F00\u5173\u540E\uFF0C\u82E5\u63CF\u8FF0\u672A\u6B63\u5E38\u751F\u6210\uFF0C\u5219\u63CF\u8FF0\u5185\u5BB9\u4E3A\u7A7A\uFF0C\u5982\u60A8\u4ECD\u7136\u9700\u8981\u63CF\u8FF0\uFF0C\u5219\u9700\u8981\u624B\u52A8\u6DFB\u52A0"},{id:"count",title:"\u6570\u636E\u91CF",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",component:e(de,{})},{id:"importstatus",title:"\u8FFD\u52A0\u63D0\u793A",type:"customized",component:e(de,{})},{id:"createdAt",title:"\u521B\u5EFA\u65F6\u95F4",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{id:"updatedAt",title:"\u66F4\u65B0\u65F6\u95F4",type:"date",tip:"\u66F4\u65B0\u65F6\u95F4"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"button",key:"upload",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",btnType:"primary",disabled:E&&E(H.ADD,B==null?void 0:B.permission),icon:e(He,{size:12})},{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description",["name"]],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}],subTableConfig:{type:"table",allowMultiSelect:!1,viewBehavior:"pagination",viewPageSize:5,columns:[{title:"\u8FFD\u52A0\u6587\u4EF6\u540D",id:"name",type:"text",tip:"\u8FFD\u52A0\u6587\u4EF6\u540D"},{title:"\u6570\u636E\u91CF",id:"count",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",tip:"\u5BFC\u5165\u72B6\u6001",component:e(de,{})},{title:"\u521B\u5EFA\u65F6\u95F4",id:"createdAt",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{title:"\u66F4\u6539\u65F6\u95F4",id:"updatedAt",type:"date",tip:"\u66F4\u6539\u65F6\u95F4"},{title:"\u64CD\u4F5C",id:"actions",type:"action"}]},subTablePendingIds:W,onSubTableRowAnimationComplete:(n,u)=>{R(w=>({...w,[n]:(w[n]||[]).filter(y=>y!==u)}))}}),[W,U,k,B]),D=n=>{i(!1),_(!1),L(void 0),n=="refresh"&&(f.current&&(clearTimeout(f.current),f.current=null),b())};function V(n){var u;if(!Array.isArray(n))return!0;for(const w of n){if(w.data){const y=w.data.find(M=>M.columnId==="status"),T=w.data.find(M=>M.columnId==="description");if(y&&(y.status==="20"||y.status==="11"||((u=T==null?void 0:T.tableMeta)==null?void 0:u.generateDescriptionStatus)==ve.GENERATING))return!1}if(Array.isArray(w.children)){for(const y of w.children)if(y.data){const T=y.data.find(M=>M.columnId==="status");if(T&&(T.status==="20"||T.status==="11"))return!1}}}return!0}const b=async()=>{const n=await le();V(n||[])?f.current&&(clearTimeout(f.current),f.current=null):(f.current&&(clearTimeout(f.current),f.current=null),f.current=setTimeout(()=>{b()},5e3))};return v(Ve,{title:B==null?void 0:B.name,description:(B==null?void 0:B.description)||"-",goBack:()=>{var n;(n=a.eventsEmit)==null||n.call(a,"goBack",{})},children:[e(Ae,{dataSource:U,ref:g,eventsEmit:d,status:z,CustomComponents:{EmptyData:()=>e(Qe,{dbInfo:B,setDrawerTitle:h,setDrawerVisible:i,getBtnDisabled:E}),...O},...k=="DataTable"?I:r}),e(qe,{drawerTitle:l,drawerVisible:s,handleDrawerClose:D,dbId:o,token:F,url:A,role:m,tableInfo:c}),e(Xe,{drawerTitle:Y,drawerVisible:p,handleDrawerClose:D,tableInfo:c,optimizeDesc:se,eventsEmit:d})]})};export{Fu as default};
package/databaseTable.js CHANGED
@@ -1,18 +1,6 @@
1
- import{jsxs as Me,jsx as k}from"react/jsx-runtime";import*as l from"react";import p,{useEffect as Ot,useMemo as Mt,useContext as Ue,Children as ft,useState as be,useRef as gi}from"react";import{u as Ke}from"./assets/index-CpW6Dhpp.js";import{c as pi,a as fi}from"./assets/index-CZ9KcyHq.js";import{a as hi,D as vi,J as ht,F as bi,k as Si}from"./assets/index-CwZH-3RQ.js";import{D as $i}from"./assets/index-DhLqP5fb.js";import{I as Tt,d as ve,a as Fe,K as pe,b as L,e as me,k as vt,ar as yi,v as Ci,f as xi,H as Ze,J as ke,aS as zi,P as et,D as C,E as bt,a2 as Ei,aT as Ni,aU as Ii,aV as wi,aW as Pi,aX as Bi,aY as Di,aZ as jt,a6 as Oi,aa as tt,a_ as _t,ag as Mi,a$ as Ti,as as ji,y as Lt,am as At,x as it,b0 as Qe,b1 as _i,h as St,b2 as $t,b3 as Rt,aI as Li,ae as Ai,aL as Ri,aH as yt}from"./assets/index-C_syaGTO.js";import{R as Ct,a as xt}from"./assets/LeftOutlined-BDNvU9GN.js";import{X as Hi}from"./assets/x-CRBeKR4J.js";import"./assets/styled-components.browser.esm-DPkS13KC.js";import"react-dom";/**
1
+ import{jsxs as S,jsx as l}from"react/jsx-runtime";import{useState as C,useRef as te,useEffect as se,useMemo as ue}from"react";import{u as z}from"./assets/index-CpW6Dhpp.js";import ne from"axios";import{Drawer as oe,Row as ce,Col as V,List as U,Input as ie,Button as re,Modal as le,message as H}from"antd";import{J,F as de,k as pe}from"./assets/index-5gkRuYoC.js";import{c as me}from"./assets/index--DG-fVvc.js";import{X as fe}from"./assets/x-tMUaBf0a.js";import"./assets/styled-components.browser.esm-DPkS13KC.js";import"react-dom";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Fi=pi("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function qi(e,t,a){var i=a||{},n=i.noTrailing,m=n===void 0?!1:n,v=i.noLeading,b=v===void 0?!1:v,g=i.debounceMode,o=g===void 0?void 0:g,c,r=!1,s=0;function y(){c&&clearTimeout(c)}function $(S){var I=S||{},N=I.upcomingOnly,w=N===void 0?!1:N;y(),r=!w}function E(){for(var S=arguments.length,I=new Array(S),N=0;N<S;N++)I[N]=arguments[N];var w=this,A=Date.now()-s;if(r)return;function d(){s=Date.now(),t.apply(w,I)}function D(){c=void 0}!b&&o&&!c&&d(),y(),o===void 0&&A>e?b?(s=Date.now(),m||(c=setTimeout(o?D:d,e))):d():m!==!0&&(c=setTimeout(o?D:d,o===void 0?e-A:e))}return E.cancel=$,E}function Wi(e,t,a){var i={},n=i.atBegin,m=n===void 0?!1:n;return qi(e,t,{debounceMode:m!==!1})}var Vi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"},Xi=function(t,a){return l.createElement(Tt,ve({},t,{ref:a,icon:Vi}))},zt=l.forwardRef(Xi),Gi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"}}]},name:"double-right",theme:"outlined"},Ki=function(t,a){return l.createElement(Tt,ve({},t,{ref:a,icon:Gi}))},Et=l.forwardRef(Ki),Ji={items_per_page:"\u6761/\u9875",jump_to:"\u8DF3\u81F3",jump_to_confirm:"\u786E\u5B9A",page:"\u9875",prev_page:"\u4E0A\u4E00\u9875",next_page:"\u4E0B\u4E00\u9875",prev_5:"\u5411\u524D 5 \u9875",next_5:"\u5411\u540E 5 \u9875",prev_3:"\u5411\u524D 3 \u9875",next_3:"\u5411\u540E 3 \u9875",page_size:"\u9875\u7801"},Ui=[10,20,50,100],Qi=function(t){var a=t.pageSizeOptions,i=a===void 0?Ui:a,n=t.locale,m=t.changeSize,v=t.pageSize,b=t.goButton,g=t.quickGo,o=t.rootPrefixCls,c=t.disabled,r=t.buildOptionText,s=t.showSizeChanger,y=t.sizeChangerRender,$=p.useState(""),E=Fe($,2),S=E[0],I=E[1],N=function(){return!S||Number.isNaN(S)?void 0:Number(S)},w=typeof r=="function"?r:function(O){return"".concat(O," ").concat(n.items_per_page)},A=function(_){I(_.target.value)},d=function(_){b||S===""||(I(""),!(_.relatedTarget&&(_.relatedTarget.className.indexOf("".concat(o,"-item-link"))>=0||_.relatedTarget.className.indexOf("".concat(o,"-item"))>=0))&&(g==null||g(N())))},D=function(_){S!==""&&(_.keyCode===pe.ENTER||_.type==="click")&&(I(""),g==null||g(N()))},j=function(){return i.some(function(_){return _.toString()===v.toString()})?i:i.concat([v]).sort(function(_,Y){var ne=Number.isNaN(Number(_))?0:Number(_),u=Number.isNaN(Number(Y))?0:Number(Y);return ne-u})},z="".concat(o,"-options");if(!s&&!g)return null;var T=null,U=null,ae=null;return s&&y&&(T=y({disabled:c,size:v,onSizeChange:function(_){m==null||m(Number(_))},"aria-label":n.page_size,className:"".concat(z,"-size-changer"),options:j().map(function(O){return{label:w(O),value:O}})})),g&&(b&&(ae=typeof b=="boolean"?p.createElement("button",{type:"button",onClick:D,onKeyUp:D,disabled:c,className:"".concat(z,"-quick-jumper-button")},n.jump_to_confirm):p.createElement("span",{onClick:D,onKeyUp:D},b)),U=p.createElement("div",{className:"".concat(z,"-quick-jumper")},n.jump_to,p.createElement("input",{disabled:c,type:"text",value:S,onChange:A,onKeyUp:D,onBlur:d,"aria-label":n.page}),n.page,ae)),p.createElement("li",{className:z},T,U)},Oe=function(t){var a=t.rootPrefixCls,i=t.page,n=t.active,m=t.className,v=t.showTitle,b=t.onClick,g=t.onKeyPress,o=t.itemRender,c="".concat(a,"-item"),r=L(c,"".concat(c,"-").concat(i),me(me({},"".concat(c,"-active"),n),"".concat(c,"-disabled"),!i),m),s=function(){b(i)},y=function(S){g(S,b,i)},$=o(i,"page",p.createElement("a",{rel:"nofollow"},i));return $?p.createElement("li",{title:v?String(i):null,className:r,onClick:s,onKeyDown:y,tabIndex:0},$):null},Yi=function(t,a,i){return i};function Nt(){}function It(e){var t=Number(e);return typeof t=="number"&&!Number.isNaN(t)&&isFinite(t)&&Math.floor(t)===t}function ye(e,t,a){var i=typeof e>"u"?t:e;return Math.floor((a-1)/i)+1}var Zi=function(t){var a=t.prefixCls,i=a===void 0?"rc-pagination":a,n=t.selectPrefixCls,m=n===void 0?"rc-select":n,v=t.className,b=t.current,g=t.defaultCurrent,o=g===void 0?1:g,c=t.total,r=c===void 0?0:c,s=t.pageSize,y=t.defaultPageSize,$=y===void 0?10:y,E=t.onChange,S=E===void 0?Nt:E,I=t.hideOnSinglePage,N=t.align,w=t.showPrevNextJumpers,A=w===void 0?!0:w,d=t.showQuickJumper,D=t.showLessItems,j=t.showTitle,z=j===void 0?!0:j,T=t.onShowSizeChange,U=T===void 0?Nt:T,ae=t.locale,O=ae===void 0?Ji:ae,_=t.style,Y=t.totalBoundaryShowSizeChanger,ne=Y===void 0?50:Y,u=t.disabled,f=t.simple,P=t.showTotal,H=t.showSizeChanger,ee=H===void 0?r>ne:H,J=t.sizeChangerRender,M=t.pageSizeOptions,se=t.itemRender,R=se===void 0?Yi:se,X=t.jumpPrevIcon,W=t.jumpNextIcon,re=t.prevIcon,ce=t.nextIcon,oe=p.useRef(null),le=vt(10,{value:s,defaultValue:$}),F=Fe(le,2),G=F[0],Se=F[1],$e=vt(1,{value:b,defaultValue:o,postState:function(B){return Math.max(1,Math.min(B,ye(void 0,G,r)))}}),fe=Fe($e,2),x=fe[0],te=fe[1],Ee=p.useState(x),Ce=Fe(Ee,2),de=Ce[0],xe=Ce[1];Ot(function(){xe(x)},[x]);var q=Math.max(1,x-(D?3:5)),Q=Math.min(ye(void 0,G,r),x+(D?3:5));function ie(h,B){var V=h||p.createElement("button",{type:"button","aria-label":B,className:"".concat(i,"-item-link")});return typeof h=="function"&&(V=p.createElement(h,xi({},t))),V}function ze(h){var B=h.target.value,V=ye(void 0,G,r),he;return B===""?he=B:Number.isNaN(Number(B))?he=de:B>=V?he=V:he=Number(B),he}function Jt(h){return It(h)&&h!==x&&It(r)&&r>0}var Ut=r>G?d:!1;function Qt(h){(h.keyCode===pe.UP||h.keyCode===pe.DOWN)&&h.preventDefault()}function nt(h){var B=ze(h);switch(B!==de&&xe(B),h.keyCode){case pe.ENTER:ue(B);break;case pe.UP:ue(B-1);break;case pe.DOWN:ue(B+1);break}}function Yt(h){ue(ze(h))}function Zt(h){var B=ye(h,G,r),V=x>B&&B!==0?B:x;Se(h),xe(V),U==null||U(x,h),te(V),S==null||S(V,h)}function ue(h){if(Jt(h)&&!u){var B=ye(void 0,G,r),V=h;return h>B?V=B:h<1&&(V=1),V!==de&&xe(V),te(V),S==null||S(V,G),V}return x}var Te=x>1,je=x<ye(void 0,G,r);function rt(){Te&&ue(x-1)}function ot(){je&&ue(x+1)}function lt(){ue(q)}function st(){ue(Q)}function Ne(h,B){if(h.key==="Enter"||h.charCode===pe.ENTER||h.keyCode===pe.ENTER){for(var V=arguments.length,he=new Array(V>2?V-2:0),He=2;He<V;He++)he[He-2]=arguments[He];B.apply(void 0,he)}}function kt(h){Ne(h,rt)}function ei(h){Ne(h,ot)}function ti(h){Ne(h,lt)}function ii(h){Ne(h,st)}function ai(h){var B=R(h,"prev",ie(re,"prev page"));return p.isValidElement(B)?p.cloneElement(B,{disabled:!Te}):B}function ni(h){var B=R(h,"next",ie(ce,"next page"));return p.isValidElement(B)?p.cloneElement(B,{disabled:!je}):B}function _e(h){(h.type==="click"||h.keyCode===pe.ENTER)&&ue(de)}var ct=null,ri=yi(t,{aria:!0,data:!0}),oi=P&&p.createElement("li",{className:"".concat(i,"-total-text")},P(r,[r===0?0:(x-1)*G+1,x*G>r?r:x*G])),dt=null,K=ye(void 0,G,r);if(I&&r<=G)return null;var Z=[],Ie={rootPrefixCls:i,onClick:ue,onKeyPress:Ne,showTitle:z,itemRender:R,page:-1},li=x-1>0?x-1:0,si=x+1<K?x+1:K,Le=d&&d.goButton,ci=Ci(f)==="object"?f.readOnly:!f,we=Le,ut=null;f&&(Le&&(typeof Le=="boolean"?we=p.createElement("button",{type:"button",onClick:_e,onKeyUp:_e},O.jump_to_confirm):we=p.createElement("span",{onClick:_e,onKeyUp:_e},Le),we=p.createElement("li",{title:z?"".concat(O.jump_to).concat(x,"/").concat(K):null,className:"".concat(i,"-simple-pager")},we)),ut=p.createElement("li",{title:z?"".concat(x,"/").concat(K):null,className:"".concat(i,"-simple-pager")},ci?de:p.createElement("input",{type:"text","aria-label":O.jump_to,value:de,disabled:u,onKeyDown:Qt,onKeyUp:nt,onChange:nt,onBlur:Yt,size:3}),p.createElement("span",{className:"".concat(i,"-slash")},"/"),K));var ge=D?1:2;if(K<=3+ge*2){K||Z.push(p.createElement(Oe,ve({},Ie,{key:"noPager",page:1,className:"".concat(i,"-item-disabled")})));for(var Pe=1;Pe<=K;Pe+=1)Z.push(p.createElement(Oe,ve({},Ie,{key:Pe,page:Pe,active:x===Pe})))}else{var di=D?O.prev_3:O.prev_5,ui=D?O.next_3:O.next_5,mt=R(q,"jump-prev",ie(X,"prev page")),gt=R(Q,"jump-next",ie(W,"next page"));A&&(ct=mt?p.createElement("li",{title:z?di:null,key:"prev",onClick:lt,tabIndex:0,onKeyDown:ti,className:L("".concat(i,"-jump-prev"),me({},"".concat(i,"-jump-prev-custom-icon"),!!X))},mt):null,dt=gt?p.createElement("li",{title:z?ui:null,key:"next",onClick:st,tabIndex:0,onKeyDown:ii,className:L("".concat(i,"-jump-next"),me({},"".concat(i,"-jump-next-custom-icon"),!!W))},gt):null);var We=Math.max(1,x-ge),Ve=Math.min(x+ge,K);x-1<=ge&&(Ve=1+ge*2),K-x<=ge&&(We=K-ge*2);for(var Be=We;Be<=Ve;Be+=1)Z.push(p.createElement(Oe,ve({},Ie,{key:Be,page:Be,active:x===Be})));if(x-1>=ge*2&&x!==3&&(Z[0]=p.cloneElement(Z[0],{className:L("".concat(i,"-item-after-jump-prev"),Z[0].props.className)}),Z.unshift(ct)),K-x>=ge*2&&x!==K-2){var pt=Z[Z.length-1];Z[Z.length-1]=p.cloneElement(pt,{className:L("".concat(i,"-item-before-jump-next"),pt.props.className)}),Z.push(dt)}We!==1&&Z.unshift(p.createElement(Oe,ve({},Ie,{key:1,page:1}))),Ve!==K&&Z.push(p.createElement(Oe,ve({},Ie,{key:K,page:K})))}var Ae=ai(li);if(Ae){var Xe=!Te||!K;Ae=p.createElement("li",{title:z?O.prev_page:null,onClick:rt,tabIndex:Xe?null:0,onKeyDown:kt,className:L("".concat(i,"-prev"),me({},"".concat(i,"-disabled"),Xe)),"aria-disabled":Xe},Ae)}var Re=ni(si);if(Re){var De,Ge;f?(De=!je,Ge=Te?0:null):(De=!je||!K,Ge=De?null:0),Re=p.createElement("li",{title:z?O.next_page:null,onClick:ot,tabIndex:Ge,onKeyDown:ei,className:L("".concat(i,"-next"),me({},"".concat(i,"-disabled"),De)),"aria-disabled":De},Re)}var mi=L(i,v,me(me(me(me(me({},"".concat(i,"-start"),N==="start"),"".concat(i,"-center"),N==="center"),"".concat(i,"-end"),N==="end"),"".concat(i,"-simple"),f),"".concat(i,"-disabled"),u));return p.createElement("ul",ve({className:mi,style:_,ref:oe},ri),oi,Ae,f?ut:Z,Re,p.createElement(Qi,{locale:O,rootPrefixCls:i,disabled:u,selectPrefixCls:m,changeSize:Zt,pageSize:G,pageSizeOptions:M,quickGo:Ut?ue:null,goButton:we,showSizeChanger:ee,sizeChangerRender:J}))};const ki=e=>{const{componentCls:t}=e;return{[`${t}-disabled`]:{"&, &:hover":{cursor:"not-allowed",[`${t}-item-link`]:{color:e.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",[`${t}-item-link`]:{color:e.colorTextDisabled,cursor:"not-allowed"}}},[`&${t}-disabled`]:{cursor:"not-allowed",[`${t}-item`]:{cursor:"not-allowed",backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"},a:{color:e.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:e.colorBorder,backgroundColor:e.itemActiveBgDisabled,"&:hover, &:active":{backgroundColor:e.itemActiveBgDisabled},a:{color:e.itemActiveColorDisabled}}},[`${t}-item-link`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},[`${t}-simple&`]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},[`${t}-simple-pager`]:{color:e.colorTextDisabled},[`${t}-jump-prev, ${t}-jump-next`]:{[`${t}-item-link-icon`]:{opacity:0},[`${t}-item-ellipsis`]:{opacity:1}}}}},ea=e=>{const{componentCls:t}=e;return{[`&${t}-mini ${t}-total-text, &${t}-mini ${t}-simple-pager`]:{height:e.itemSizeSM,lineHeight:C(e.itemSizeSM)},[`&${t}-mini ${t}-item`]:{minWidth:e.itemSizeSM,height:e.itemSizeSM,margin:0,lineHeight:C(e.calc(e.itemSizeSM).sub(2).equal())},[`&${t}-mini ${t}-prev, &${t}-mini ${t}-next`]:{minWidth:e.itemSizeSM,height:e.itemSizeSM,margin:0,lineHeight:C(e.itemSizeSM)},[`&${t}-mini:not(${t}-disabled)`]:{[`${t}-prev, ${t}-next`]:{[`&:hover ${t}-item-link`]:{backgroundColor:e.colorBgTextHover},[`&:active ${t}-item-link`]:{backgroundColor:e.colorBgTextActive},[`&${t}-disabled:hover ${t}-item-link`]:{backgroundColor:"transparent"}}},[`
7
- &${t}-mini ${t}-prev ${t}-item-link,
8
- &${t}-mini ${t}-next ${t}-item-link
9
- `]:{backgroundColor:"transparent",borderColor:"transparent","&::after":{height:e.itemSizeSM,lineHeight:C(e.itemSizeSM)}},[`&${t}-mini ${t}-jump-prev, &${t}-mini ${t}-jump-next`]:{height:e.itemSizeSM,marginInlineEnd:0,lineHeight:C(e.itemSizeSM)},[`&${t}-mini ${t}-options`]:{marginInlineStart:e.paginationMiniOptionsMarginInlineStart,"&-size-changer":{top:e.miniOptionsSizeChangerTop},"&-quick-jumper":{height:e.itemSizeSM,lineHeight:C(e.itemSizeSM),input:Object.assign(Object.assign({},Bi(e)),{width:e.paginationMiniQuickJumperInputWidth,height:e.controlHeightSM})}}}},ta=e=>{const{componentCls:t}=e;return{[`&${t}-simple`]:{[`${t}-prev, ${t}-next`]:{height:e.itemSize,lineHeight:C(e.itemSize),verticalAlign:"top",[`${t}-item-link`]:{height:e.itemSize,backgroundColor:"transparent",border:0,"&:hover":{backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive},"&::after":{height:e.itemSize,lineHeight:C(e.itemSize)}}},[`${t}-simple-pager`]:{display:"inline-flex",alignItems:"center",height:e.itemSize,marginInlineEnd:e.marginXS,input:{boxSizing:"border-box",height:"100%",width:e.quickJumperInputWidth,padding:`0 ${C(e.paginationItemPaddingInline)}`,textAlign:"center",backgroundColor:e.itemInputBg,border:`${C(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadius,outline:"none",transition:`border-color ${e.motionDurationMid}`,color:"inherit","&:hover":{borderColor:e.colorPrimary},"&:focus":{borderColor:e.colorPrimaryHover,boxShadow:`${C(e.inputOutlineOffset)} 0 ${C(e.controlOutlineWidth)} ${e.controlOutline}`},"&[disabled]":{color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,cursor:"not-allowed"}}},[`&${t}-disabled`]:{[`${t}-prev, ${t}-next`]:{[`${t}-item-link`]:{"&:hover, &:active":{backgroundColor:"transparent"}}}},[`&${t}-mini`]:{[`${t}-prev, ${t}-next`]:{height:e.itemSizeSM,lineHeight:C(e.itemSizeSM),[`${t}-item-link`]:{height:e.itemSizeSM,"&::after":{height:e.itemSizeSM,lineHeight:C(e.itemSizeSM)}}},[`${t}-simple-pager`]:{height:e.itemSizeSM,width:e.paginationMiniQuickJumperInputWidth}}}}},ia=e=>{const{componentCls:t}=e;return{[`${t}-jump-prev, ${t}-jump-next`]:{outline:0,[`${t}-item-container`]:{position:"relative",[`${t}-item-link-icon`]:{color:e.colorPrimary,fontSize:e.fontSizeSM,opacity:0,transition:`all ${e.motionDurationMid}`,"&-svg":{top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,margin:"auto"}},[`${t}-item-ellipsis`]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,display:"block",margin:"auto",color:e.colorTextDisabled,letterSpacing:e.paginationEllipsisLetterSpacing,textAlign:"center",textIndent:e.paginationEllipsisTextIndent,opacity:1,transition:`all ${e.motionDurationMid}`}},"&:hover":{[`${t}-item-link-icon`]:{opacity:1},[`${t}-item-ellipsis`]:{opacity:0}}},[`
10
- ${t}-prev,
11
- ${t}-jump-prev,
12
- ${t}-jump-next
13
- `]:{marginInlineEnd:e.marginXS},[`
14
- ${t}-prev,
15
- ${t}-next,
16
- ${t}-jump-prev,
17
- ${t}-jump-next
18
- `]:{display:"inline-block",minWidth:e.itemSize,height:e.itemSize,color:e.colorText,fontFamily:e.fontFamily,lineHeight:C(e.itemSize),textAlign:"center",verticalAlign:"middle",listStyle:"none",borderRadius:e.borderRadius,cursor:"pointer",transition:`all ${e.motionDurationMid}`},[`${t}-prev, ${t}-next`]:{outline:0,button:{color:e.colorText,cursor:"pointer",userSelect:"none"},[`${t}-item-link`]:{display:"block",width:"100%",height:"100%",padding:0,fontSize:e.fontSizeSM,textAlign:"center",backgroundColor:"transparent",border:`${C(e.lineWidth)} ${e.lineType} transparent`,borderRadius:e.borderRadius,outline:"none",transition:`all ${e.motionDurationMid}`},[`&:hover ${t}-item-link`]:{backgroundColor:e.colorBgTextHover},[`&:active ${t}-item-link`]:{backgroundColor:e.colorBgTextActive},[`&${t}-disabled:hover`]:{[`${t}-item-link`]:{backgroundColor:"transparent"}}},[`${t}-slash`]:{marginInlineEnd:e.paginationSlashMarginInlineEnd,marginInlineStart:e.paginationSlashMarginInlineStart},[`${t}-options`]:{display:"inline-block",marginInlineStart:e.margin,verticalAlign:"middle","&-size-changer":{display:"inline-block",width:"auto"},"&-quick-jumper":{display:"inline-block",height:e.controlHeight,marginInlineStart:e.marginXS,lineHeight:C(e.controlHeight),verticalAlign:"top",input:Object.assign(Object.assign(Object.assign({},Ii(e)),wi(e,{borderColor:e.colorBorder,hoverBorderColor:e.colorPrimaryHover,activeBorderColor:e.colorPrimary,activeShadow:e.activeShadow})),{"&[disabled]":Object.assign({},Pi(e)),width:e.quickJumperInputWidth,height:e.controlHeight,boxSizing:"border-box",margin:0,marginInlineStart:e.marginXS,marginInlineEnd:e.marginXS})}}}},aa=e=>{const{componentCls:t}=e;return{[`${t}-item`]:{display:"inline-block",minWidth:e.itemSize,height:e.itemSize,marginInlineEnd:e.marginXS,fontFamily:e.fontFamily,lineHeight:C(e.calc(e.itemSize).sub(2).equal()),textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:e.itemBg,border:`${C(e.lineWidth)} ${e.lineType} transparent`,borderRadius:e.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:`0 ${C(e.paginationItemPaddingInline)}`,color:e.colorText,"&:hover":{textDecoration:"none"}},[`&:not(${t}-item-active)`]:{"&:hover":{transition:`all ${e.motionDurationMid}`,backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},"&-active":{fontWeight:e.fontWeightStrong,backgroundColor:e.itemActiveBg,borderColor:e.colorPrimary,a:{color:e.colorPrimary},"&:hover":{borderColor:e.colorPrimaryHover},"&:hover a":{color:e.colorPrimaryHover}}}}},na=e=>{const{componentCls:t}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},et(e)),{display:"flex","&-start":{justifyContent:"start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"end"},"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},[`${t}-total-text`]:{display:"inline-block",height:e.itemSize,marginInlineEnd:e.marginXS,lineHeight:C(e.calc(e.itemSize).sub(2).equal()),verticalAlign:"middle"}}),aa(e)),ia(e)),ta(e)),ea(e)),ki(e)),{[`@media only screen and (max-width: ${e.screenLG}px)`]:{[`${t}-item`]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},[`@media only screen and (max-width: ${e.screenSM}px)`]:{[`${t}-options`]:{display:"none"}}}),[`&${e.componentCls}-rtl`]:{direction:"rtl"}}},ra=e=>{const{componentCls:t}=e;return{[`${t}:not(${t}-disabled)`]:{[`${t}-item`]:Object.assign({},Ei(e)),[`${t}-jump-prev, ${t}-jump-next`]:{"&:focus-visible":Object.assign({[`${t}-item-link-icon`]:{opacity:1},[`${t}-item-ellipsis`]:{opacity:0}},bt(e))},[`${t}-prev, ${t}-next`]:{[`&:focus-visible ${t}-item-link`]:bt(e)}}}},Ht=e=>Object.assign({itemBg:e.colorBgContainer,itemSize:e.controlHeight,itemSizeSM:e.controlHeightSM,itemActiveBg:e.colorBgContainer,itemLinkBg:e.colorBgContainer,itemActiveColorDisabled:e.colorTextDisabled,itemActiveBgDisabled:e.controlItemBgActiveDisabled,itemInputBg:e.colorBgContainer,miniOptionsSizeChangerTop:0},Ni(e)),Ft=e=>ke(e,{inputOutlineOffset:0,quickJumperInputWidth:e.calc(e.controlHeightLG).mul(1.25).equal(),paginationMiniOptionsMarginInlineStart:e.calc(e.marginXXS).div(2).equal(),paginationMiniQuickJumperInputWidth:e.calc(e.controlHeightLG).mul(1.1).equal(),paginationItemPaddingInline:e.calc(e.marginXXS).mul(1.5).equal(),paginationEllipsisLetterSpacing:e.calc(e.marginXXS).div(2).equal(),paginationSlashMarginInlineStart:e.marginSM,paginationSlashMarginInlineEnd:e.marginSM,paginationEllipsisTextIndent:"0.13em"},zi(e)),oa=Ze("Pagination",e=>{const t=Ft(e);return[na(t),ra(t)]},Ht),la=e=>{const{componentCls:t}=e;return{[`${t}${t}-bordered${t}-disabled:not(${t}-mini)`]:{"&, &:hover":{[`${t}-item-link`]:{borderColor:e.colorBorder}},"&:focus-visible":{[`${t}-item-link`]:{borderColor:e.colorBorder}},[`${t}-item, ${t}-item-link`]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,[`&:hover:not(${t}-item-active)`]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,a:{color:e.colorTextDisabled}},[`&${t}-item-active`]:{backgroundColor:e.itemActiveBgDisabled}},[`${t}-prev, ${t}-next`]:{"&:hover button":{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,color:e.colorTextDisabled},[`${t}-item-link`]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder}}},[`${t}${t}-bordered:not(${t}-mini)`]:{[`${t}-prev, ${t}-next`]:{"&:hover button":{borderColor:e.colorPrimaryHover,backgroundColor:e.itemBg},[`${t}-item-link`]:{backgroundColor:e.itemLinkBg,borderColor:e.colorBorder},[`&:hover ${t}-item-link`]:{borderColor:e.colorPrimary,backgroundColor:e.itemBg,color:e.colorPrimary},[`&${t}-disabled`]:{[`${t}-item-link`]:{borderColor:e.colorBorder,color:e.colorTextDisabled}}},[`${t}-item`]:{backgroundColor:e.itemBg,border:`${C(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,[`&:hover:not(${t}-item-active)`]:{borderColor:e.colorPrimary,backgroundColor:e.itemBg,a:{color:e.colorPrimary}},"&-active":{borderColor:e.colorPrimary}}}}},sa=Di(["Pagination","bordered"],e=>{const t=Ft(e);return la(t)},Ht);function wt(e){return Mt(()=>typeof e=="boolean"?[e,{}]:e&&typeof e=="object"?[!0,e]:[void 0,void 0],[e])}var ca=function(e,t){var a={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(a[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(a[i[n]]=e[i[n]]);return a};const da=e=>{const{align:t,prefixCls:a,selectPrefixCls:i,className:n,rootClassName:m,style:v,size:b,locale:g,responsive:o,showSizeChanger:c,selectComponentClass:r,pageSizeOptions:s}=e,y=ca(e,["align","prefixCls","selectPrefixCls","className","rootClassName","style","size","locale","responsive","showSizeChanger","selectComponentClass","pageSizeOptions"]),{xs:$}=jt(o),[,E]=Oi(),{getPrefixCls:S,direction:I,showSizeChanger:N,className:w,style:A}=tt("pagination"),d=S("pagination",a),[D,j,z]=oa(d),T=_t(b),U=T==="small"||!!($&&!T&&o),[ae]=Mi("Pagination",Ti),O=Object.assign(Object.assign({},ae),g),[_,Y]=wt(c),[ne,u]=wt(N),f=_??ne,P=Y??u,H=r||hi,ee=l.useMemo(()=>s?s.map(W=>Number(W)):void 0,[s]),J=W=>{var re;const{disabled:ce,size:oe,onSizeChange:le,"aria-label":F,className:G,options:Se}=W,{className:$e,onChange:fe}=P||{},x=(re=Se.find(te=>String(te.value)===String(oe)))===null||re===void 0?void 0:re.value;return l.createElement(H,Object.assign({disabled:ce,showSearch:!0,popupMatchSelectWidth:!1,getPopupContainer:te=>te.parentNode,"aria-label":F,options:Se},P,{value:x,onChange:(te,Ee)=>{le==null||le(te),fe==null||fe(te,Ee)},size:U?"small":"middle",className:L(G,$e)}))},M=l.useMemo(()=>{const W=l.createElement("span",{className:`${d}-item-ellipsis`},"\u2022\u2022\u2022"),re=l.createElement("button",{className:`${d}-item-link`,type:"button",tabIndex:-1},I==="rtl"?l.createElement(xt,null):l.createElement(Ct,null)),ce=l.createElement("button",{className:`${d}-item-link`,type:"button",tabIndex:-1},I==="rtl"?l.createElement(Ct,null):l.createElement(xt,null)),oe=l.createElement("a",{className:`${d}-item-link`},l.createElement("div",{className:`${d}-item-container`},I==="rtl"?l.createElement(Et,{className:`${d}-item-link-icon`}):l.createElement(zt,{className:`${d}-item-link-icon`}),W)),le=l.createElement("a",{className:`${d}-item-link`},l.createElement("div",{className:`${d}-item-container`},I==="rtl"?l.createElement(zt,{className:`${d}-item-link-icon`}):l.createElement(Et,{className:`${d}-item-link-icon`}),W));return{prevIcon:re,nextIcon:ce,jumpPrevIcon:oe,jumpNextIcon:le}},[I,d]),se=S("select",i),R=L({[`${d}-${t}`]:!!t,[`${d}-mini`]:U,[`${d}-rtl`]:I==="rtl",[`${d}-bordered`]:E.wireframe},w,n,m,j,z),X=Object.assign(Object.assign({},A),v);return D(l.createElement(l.Fragment,null,E.wireframe&&l.createElement(sa,{prefixCls:d}),l.createElement(Zi,Object.assign({},M,y,{style:X,prefixCls:d,selectPrefixCls:se,className:R,locale:O,pageSizeOptions:ee,showSizeChanger:f,sizeChangerRender:J}))))},qe=100,qt=qe/5,Wt=qe/2-qt/2,Je=Wt*2*Math.PI,Pt=50,Bt=e=>{const{dotClassName:t,style:a,hasCircleCls:i}=e;return l.createElement("circle",{className:L(`${t}-circle`,{[`${t}-circle-bg`]:i}),r:Wt,cx:Pt,cy:Pt,strokeWidth:qt,style:a})},ua=({percent:e,prefixCls:t})=>{const a=`${t}-dot`,i=`${a}-holder`,n=`${i}-hidden`,[m,v]=l.useState(!1);ji(()=>{e!==0&&v(!0)},[e!==0]);const b=Math.max(Math.min(e,100),0);if(!m)return null;const g={strokeDashoffset:`${Je/4}`,strokeDasharray:`${Je*b/100} ${Je*(100-b)/100}`};return l.createElement("span",{className:L(i,`${a}-progress`,b<=0&&n)},l.createElement("svg",{viewBox:`0 0 ${qe} ${qe}`,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":b},l.createElement(Bt,{dotClassName:a,hasCircleCls:!0}),l.createElement(Bt,{dotClassName:a,style:g})))};function ma(e){const{prefixCls:t,percent:a=0}=e,i=`${t}-dot`,n=`${i}-holder`,m=`${n}-hidden`;return l.createElement(l.Fragment,null,l.createElement("span",{className:L(n,a>0&&m)},l.createElement("span",{className:L(i,`${t}-dot-spin`)},[1,2,3,4].map(v=>l.createElement("i",{className:`${t}-dot-item`,key:v})))),l.createElement(ua,{prefixCls:t,percent:a}))}function ga(e){var t;const{prefixCls:a,indicator:i,percent:n}=e,m=`${a}-dot`;return i&&l.isValidElement(i)?Lt(i,{className:L((t=i.props)===null||t===void 0?void 0:t.className,m),percent:n}):l.createElement(ma,{prefixCls:a,percent:n})}const pa=new At("antSpinMove",{to:{opacity:1}}),fa=new At("antRotate",{to:{transform:"rotate(405deg)"}}),ha=e=>{const{componentCls:t,calc:a}=e;return{[t]:Object.assign(Object.assign({},et(e)),{position:"absolute",display:"none",color:e.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${t}-text`]:{fontSize:e.fontSize,paddingTop:a(a(e.dotSize).sub(e.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:e.colorBgMask,zIndex:e.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${e.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[t]:{[`${t}-dot-holder`]:{color:e.colorWhite},[`${t}-text`]:{color:e.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${t}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:e.contentHeight,[`${t}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:a(e.dotSize).mul(-1).div(2).equal()},[`${t}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${e.colorBgContainer}`},[`&${t}-show-text ${t}-dot`]:{marginTop:a(e.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${t}-dot`]:{margin:a(e.dotSizeSM).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:a(a(e.dotSizeSM).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:a(e.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${t}-dot`]:{margin:a(e.dotSizeLG).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:a(a(e.dotSizeLG).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:a(e.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${t}-container`]:{position:"relative",transition:`opacity ${e.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:e.colorBgContainer,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${t}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:e.spinDotDefault},[`${t}-dot-holder`]:{width:"1em",height:"1em",fontSize:e.dotSize,display:"inline-block",transition:`transform ${e.motionDurationSlow} ease, opacity ${e.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:e.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${t}-dot-progress`]:{position:"absolute",inset:0},[`${t}-dot`]:{position:"relative",display:"inline-block",fontSize:e.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:a(e.dotSize).sub(a(e.marginXXS).div(2)).div(2).equal(),height:a(e.dotSize).sub(a(e.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:pa,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:fa,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(i=>`${i} ${e.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:e.colorFillSecondary}},[`&-sm ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeSM}},[`&-sm ${t}-dot-holder`]:{i:{width:a(a(e.dotSizeSM).sub(a(e.marginXXS).div(2))).div(2).equal(),height:a(a(e.dotSizeSM).sub(a(e.marginXXS).div(2))).div(2).equal()}},[`&-lg ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeLG}},[`&-lg ${t}-dot-holder`]:{i:{width:a(a(e.dotSizeLG).sub(e.marginXXS)).div(2).equal(),height:a(a(e.dotSizeLG).sub(e.marginXXS)).div(2).equal()}},[`&${t}-show-text ${t}-text`]:{display:"block"}})}},va=e=>{const{controlHeightLG:t,controlHeight:a}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:t*.35,dotSizeLG:a}},ba=Ze("Spin",e=>{const t=ke(e,{spinDotDefault:e.colorTextDescription});return ha(t)},va),Sa=200,Dt=[[30,.05],[70,.03],[96,.01]];function $a(e,t){const[a,i]=l.useState(0),n=l.useRef(null),m=t==="auto";return l.useEffect(()=>(m&&e&&(i(0),n.current=setInterval(()=>{i(v=>{const b=100-v;for(let g=0;g<Dt.length;g+=1){const[o,c]=Dt[g];if(v<=o)return v+b*c}return v})},Sa)),()=>{clearInterval(n.current)}),[m,e]),m?a:t}var ya=function(e,t){var a={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(a[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(a[i[n]]=e[i[n]]);return a};let Vt;function Ca(e,t){return!!e&&!!t&&!Number.isNaN(Number(t))}const Xt=e=>{var t;const{prefixCls:a,spinning:i=!0,delay:n=0,className:m,rootClassName:v,size:b="default",tip:g,wrapperClassName:o,style:c,children:r,fullscreen:s=!1,indicator:y,percent:$}=e,E=ya(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:S,direction:I,className:N,style:w,indicator:A}=tt("spin"),d=S("spin",a),[D,j,z]=ba(d),[T,U]=l.useState(()=>i&&!Ca(i,n)),ae=$a(T,$);l.useEffect(()=>{if(i){const P=Wi(n,()=>{U(!0)});return P(),()=>{var H;(H=P==null?void 0:P.cancel)===null||H===void 0||H.call(P)}}U(!1)},[n,i]);const O=l.useMemo(()=>typeof r<"u"&&!s,[r,s]),_=L(d,N,{[`${d}-sm`]:b==="small",[`${d}-lg`]:b==="large",[`${d}-spinning`]:T,[`${d}-show-text`]:!!g,[`${d}-rtl`]:I==="rtl"},m,!s&&v,j,z),Y=L(`${d}-container`,{[`${d}-blur`]:T}),ne=(t=y??A)!==null&&t!==void 0?t:Vt,u=Object.assign(Object.assign({},w),c),f=l.createElement("div",Object.assign({},E,{style:u,className:_,"aria-live":"polite","aria-busy":T}),l.createElement(ga,{prefixCls:d,indicator:ne,percent:ae}),g&&(O||s)?l.createElement("div",{className:`${d}-text`},g):null);return D(O?l.createElement("div",Object.assign({},E,{className:L(`${d}-nested-loading`,o,j,z)}),T&&l.createElement("div",{key:"loading"},f),l.createElement("div",{className:Y,key:"container"},r)):s?l.createElement("div",{className:L(`${d}-fullscreen`,{[`${d}-fullscreen-show`]:T},v,j,z)},f):f)};Xt.setDefaultIndicator=e=>{Vt=e};const at=p.createContext({});at.Consumer;var Gt=function(e,t){var a={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(a[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(a[i[n]]=e[i[n]]);return a};const xa=e=>{var{prefixCls:t,className:a,avatar:i,title:n,description:m}=e,v=Gt(e,["prefixCls","className","avatar","title","description"]);const{getPrefixCls:b}=Ue(it),g=b("list",t),o=L(`${g}-item-meta`,a),c=p.createElement("div",{className:`${g}-item-meta-content`},n&&p.createElement("h4",{className:`${g}-item-meta-title`},n),m&&p.createElement("div",{className:`${g}-item-meta-description`},m));return p.createElement("div",Object.assign({},v,{className:o}),i&&p.createElement("div",{className:`${g}-item-meta-avatar`},i),(n||m)&&c)},za=p.forwardRef((e,t)=>{const{prefixCls:a,children:i,actions:n,extra:m,styles:v,className:b,classNames:g,colStyle:o}=e,c=Gt(e,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:r,itemLayout:s}=Ue(at),{getPrefixCls:y,list:$}=Ue(it),E=j=>{var z,T;return L((T=(z=$==null?void 0:$.item)===null||z===void 0?void 0:z.classNames)===null||T===void 0?void 0:T[j],g==null?void 0:g[j])},S=j=>{var z,T;return Object.assign(Object.assign({},(T=(z=$==null?void 0:$.item)===null||z===void 0?void 0:z.styles)===null||T===void 0?void 0:T[j]),v==null?void 0:v[j])},I=()=>{let j=!1;return ft.forEach(i,z=>{typeof z=="string"&&(j=!0)}),j&&ft.count(i)>1},N=()=>s==="vertical"?!!m:!I(),w=y("list",a),A=n&&n.length>0&&p.createElement("ul",{className:L(`${w}-item-action`,E("actions")),key:"actions",style:S("actions")},n.map((j,z)=>p.createElement("li",{key:`${w}-item-action-${z}`},j,z!==n.length-1&&p.createElement("em",{className:`${w}-item-action-split`})))),d=r?"div":"li",D=p.createElement(d,Object.assign({},c,r?{}:{ref:t},{className:L(`${w}-item`,{[`${w}-item-no-flex`]:!N()},b)}),s==="vertical"&&m?[p.createElement("div",{className:`${w}-item-main`,key:"content"},i,A),p.createElement("div",{className:L(`${w}-item-extra`,E("extra")),key:"extra",style:S("extra")},m)]:[i,A,Lt(m,{key:"extra"})]);return r?p.createElement(Qe,{ref:t,flex:1,style:o},D):D}),Kt=za;Kt.Meta=xa;const Ea=e=>{const{listBorderedCls:t,componentCls:a,paddingLG:i,margin:n,itemPaddingSM:m,itemPaddingLG:v,marginLG:b,borderRadiusLG:g}=e;return{[t]:{border:`${C(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:g,[`${a}-header,${a}-footer,${a}-item`]:{paddingInline:i},[`${a}-pagination`]:{margin:`${C(n)} ${C(b)}`}},[`${t}${a}-sm`]:{[`${a}-item,${a}-header,${a}-footer`]:{padding:m}},[`${t}${a}-lg`]:{[`${a}-item,${a}-header,${a}-footer`]:{padding:v}}}},Na=e=>{const{componentCls:t,screenSM:a,screenMD:i,marginLG:n,marginSM:m,margin:v}=e;return{[`@media screen and (max-width:${i}px)`]:{[t]:{[`${t}-item`]:{[`${t}-item-action`]:{marginInlineStart:n}}},[`${t}-vertical`]:{[`${t}-item`]:{[`${t}-item-extra`]:{marginInlineStart:n}}}},[`@media screen and (max-width: ${a}px)`]:{[t]:{[`${t}-item`]:{flexWrap:"wrap",[`${t}-action`]:{marginInlineStart:m}}},[`${t}-vertical`]:{[`${t}-item`]:{flexWrap:"wrap-reverse",[`${t}-item-main`]:{minWidth:e.contentWidth},[`${t}-item-extra`]:{margin:`auto auto ${C(v)}`}}}}}},Ia=e=>{const{componentCls:t,antCls:a,controlHeight:i,minHeight:n,paddingSM:m,marginLG:v,padding:b,itemPadding:g,colorPrimary:o,itemPaddingSM:c,itemPaddingLG:r,paddingXS:s,margin:y,colorText:$,colorTextDescription:E,motionDurationSlow:S,lineWidth:I,headerBg:N,footerBg:w,emptyTextPadding:A,metaMarginBottom:d,avatarMarginRight:D,titleMarginBottom:j,descriptionFontSize:z}=e;return{[t]:Object.assign(Object.assign({},et(e)),{position:"relative","--rc-virtual-list-scrollbar-bg":e.colorSplit,"*":{outline:"none"},[`${t}-header`]:{background:N},[`${t}-footer`]:{background:w},[`${t}-header, ${t}-footer`]:{paddingBlock:m},[`${t}-pagination`]:{marginBlockStart:v,[`${a}-pagination-options`]:{textAlign:"start"}},[`${t}-spin`]:{minHeight:n,textAlign:"center"},[`${t}-items`]:{margin:0,padding:0,listStyle:"none"},[`${t}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:g,color:$,[`${t}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${t}-item-meta-avatar`]:{marginInlineEnd:D},[`${t}-item-meta-content`]:{flex:"1 0",width:0,color:$},[`${t}-item-meta-title`]:{margin:`0 0 ${C(e.marginXXS)} 0`,color:$,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:$,transition:`all ${S}`,"&:hover":{color:o}}},[`${t}-item-meta-description`]:{color:E,fontSize:z,lineHeight:e.lineHeight}},[`${t}-item-action`]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${C(s)}`,color:E,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${t}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:I,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},[`${t}-empty`]:{padding:`${C(b)} 0`,color:E,fontSize:e.fontSizeSM,textAlign:"center"},[`${t}-empty-text`]:{padding:A,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},[`${t}-item-no-flex`]:{display:"block"}}),[`${t}-grid ${a}-col > ${t}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:y,paddingBlock:0,borderBlockEnd:"none"},[`${t}-vertical ${t}-item`]:{alignItems:"initial",[`${t}-item-main`]:{display:"block",flex:1},[`${t}-item-extra`]:{marginInlineStart:v},[`${t}-item-meta`]:{marginBlockEnd:d,[`${t}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:j,color:$,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},[`${t}-item-action`]:{marginBlockStart:b,marginInlineStart:"auto","> li":{padding:`0 ${C(b)}`,"&:first-child":{paddingInlineStart:0}}}},[`${t}-split ${t}-item`]:{borderBlockEnd:`${C(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${t}-split ${t}-header`]:{borderBlockEnd:`${C(e.lineWidth)} ${e.lineType} ${e.colorSplit}`},[`${t}-split${t}-empty ${t}-footer`]:{borderTop:`${C(e.lineWidth)} ${e.lineType} ${e.colorSplit}`},[`${t}-loading ${t}-spin-nested-loading`]:{minHeight:i},[`${t}-split${t}-something-after-last-item ${a}-spin-container > ${t}-items > ${t}-item:last-child`]:{borderBlockEnd:`${C(e.lineWidth)} ${e.lineType} ${e.colorSplit}`},[`${t}-lg ${t}-item`]:{padding:r},[`${t}-sm ${t}-item`]:{padding:c},[`${t}:not(${t}-vertical)`]:{[`${t}-item-no-flex`]:{[`${t}-item-action`]:{float:"right"}}}}},wa=e=>({contentWidth:220,itemPadding:`${C(e.paddingContentVertical)} 0`,itemPaddingSM:`${C(e.paddingContentVerticalSM)} ${C(e.paddingContentHorizontal)}`,itemPaddingLG:`${C(e.paddingContentVerticalLG)} ${C(e.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize}),Pa=Ze("List",e=>{const t=ke(e,{listBorderedCls:`${e.componentCls}-bordered`,minHeight:e.controlHeightLG});return[Ia(t),Ea(t),Na(t)]},wa);var Ba=function(e,t){var a={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(a[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(a[i[n]]=e[i[n]]);return a};function Da(e,t){const{pagination:a=!1,prefixCls:i,bordered:n=!1,split:m=!0,className:v,rootClassName:b,style:g,children:o,itemLayout:c,loadMore:r,grid:s,dataSource:y=[],size:$,header:E,footer:S,loading:I=!1,rowKey:N,renderItem:w,locale:A}=e,d=Ba(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),D=a&&typeof a=="object"?a:{},[j,z]=l.useState(D.defaultCurrent||1),[T,U]=l.useState(D.defaultPageSize||10),{getPrefixCls:ae,direction:O,className:_,style:Y}=tt("list"),{renderEmpty:ne}=l.useContext(it),u={current:1,total:0,position:"bottom"},f=q=>(Q,ie)=>{var ze;z(Q),U(ie),a&&((ze=a==null?void 0:a[q])===null||ze===void 0||ze.call(a,Q,ie))},P=f("onChange"),H=f("onShowSizeChange"),ee=(q,Q)=>{if(!w)return null;let ie;return typeof N=="function"?ie=N(q):N?ie=q[N]:ie=q.key,ie||(ie=`list-item-${Q}`),l.createElement(l.Fragment,{key:ie},w(q,Q))},J=!!(r||a||S),M=ae("list",i),[se,R,X]=Pa(M);let W=I;typeof W=="boolean"&&(W={spinning:W});const re=!!(W!=null&&W.spinning),ce=_t($);let oe="";switch(ce){case"large":oe="lg";break;case"small":oe="sm";break}const le=L(M,{[`${M}-vertical`]:c==="vertical",[`${M}-${oe}`]:oe,[`${M}-split`]:m,[`${M}-bordered`]:n,[`${M}-loading`]:re,[`${M}-grid`]:!!s,[`${M}-something-after-last-item`]:J,[`${M}-rtl`]:O==="rtl"},_,v,b,R,X),F=_i(u,{total:y.length,current:j,pageSize:T},a||{}),G=Math.ceil(F.total/F.pageSize);F.current=Math.min(F.current,G);const Se=a&&l.createElement("div",{className:L(`${M}-pagination`)},l.createElement(da,Object.assign({align:"end"},F,{onChange:P,onShowSizeChange:H})));let $e=St(y);a&&y.length>(F.current-1)*F.pageSize&&($e=St(y).splice((F.current-1)*F.pageSize,F.pageSize));const fe=Object.keys(s||{}).some(q=>["xs","sm","md","lg","xl","xxl"].includes(q)),x=jt(fe),te=l.useMemo(()=>{for(let q=0;q<$t.length;q+=1){const Q=$t[q];if(x[Q])return Q}},[x]),Ee=l.useMemo(()=>{if(!s)return;const q=te&&s[te]?s[te]:s.column;if(q)return{width:`${100/q}%`,maxWidth:`${100/q}%`}},[JSON.stringify(s),te]);let Ce=re&&l.createElement("div",{style:{minHeight:53}});if($e.length>0){const q=$e.map(ee);Ce=s?l.createElement(Rt,{gutter:s.gutter},l.Children.map(q,Q=>l.createElement("div",{key:Q==null?void 0:Q.key,style:Ee},Q))):l.createElement("ul",{className:`${M}-items`},q)}else!o&&!re&&(Ce=l.createElement("div",{className:`${M}-empty-text`},(A==null?void 0:A.emptyText)||(ne==null?void 0:ne("List"))||l.createElement(vi,{componentName:"List"})));const de=F.position,xe=l.useMemo(()=>({grid:s,itemLayout:c}),[JSON.stringify(s),c]);return se(l.createElement(at.Provider,{value:xe},l.createElement("div",Object.assign({ref:t,style:Object.assign(Object.assign({},Y),g),className:le},d),(de==="top"||de==="both")&&Se,E&&l.createElement("div",{className:`${M}-header`},E),l.createElement(Xt,Object.assign({},W),Ce,o),S&&l.createElement("div",{className:`${M}-footer`},S),r||(de==="bottom"||de==="both")&&Se)))}const Oa=l.forwardRef(Da),Ye=Oa;Ye.Item=Kt;const Ma=({url:e,token:t,role:a,eventsEmit:i})=>{const n=fi.create({baseURL:e,timeout:1e6});return n.interceptors.request.use(o=>{let c=t;return!c&&!["user/login","user/kaptcha","user/regist"].some(s=>o.url.includes(s))?(i&&i("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(o.headers.Authorization=c||"",o.headers.userName=a==="\u672A\u767B\u5F55\u7528\u6237"?"":a,o)}),n.interceptors.response.use(o=>{const c=["user/kaptcha"],r=o.data;if(c.some(E=>o.config.url&&o.config.url.includes(E))||r.size&&r.type)return r;const{success:s,errorMsg:y,errorCode:$}=r;return s?r:(i&&i("request:error_business",{errorCode:$,errorMsg:y||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r}),!1)},o=>{var c,r,s,y,$,E,S,I,N;if(o.message==="canceled")return Promise.reject(o);if(i){let w="request:error_network",A={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:o};((c=o==null?void 0:o.response)==null?void 0:c.status)===401?(w="request:error_auth",A={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:o,redirect:"/login"}):(((s=(r=o==null?void 0:o.response)==null?void 0:r.data)==null?void 0:s.errorCode)==="30013"||(($=(y=o==null?void 0:o.response)==null?void 0:y.data)==null?void 0:$.errorCode)==="30023")&&(w="request:error_business",A={errorCode:(S=(E=o==null?void 0:o.response)==null?void 0:E.data)==null?void 0:S.errorCode,errorMsg:((N=(I=o==null?void 0:o.response)==null?void 0:I.data)==null?void 0:N.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:o}),i(w,A)}return Promise.reject(o)}),{getTableDataList:async({dbId:o,name:c,params:r})=>{try{const s=await n.get(`/directDB/queryTableData/${o}/${c}?${new URLSearchParams(r).toString()}`),{success:y,data:$}=s;if(y)return $}catch(s){return console.log("getTableDataList error:",s),!1}},updateTableData:async(o,c)=>{try{const r=await n.post(`/dataTable/dataUpdateRow/${o}`,{...c}),{success:s,data:y}=r;if(s)return y}catch(r){return console.log("updateTableData error:",r),!1}},delTableDataById:async({tableId:o,rowId:c})=>{try{const r=await n.delete(`/dataTable/dataDeleteRow/${o}/${c}`),{success:s,data:y}=r;if(s)return y}catch(r){console.log("delTableDataById error:",r)}},getFileDataList:async({fileId:o,params:c})=>{try{const r=await n.get(`/dataTable/queryTableFileData/${o}?${new URLSearchParams(c).toString()}`),{success:s,data:y}=r;return s?y:!1}catch(r){return console.log("e",r),!1}}}},Ta=({drawerVisible:e,handleDrawerClose:t,rowData:a})=>{const[i,n]=be(a.data),[m,v]=be(null),[b,g]=be(""),o=r=>{g(r.value),v(r.columnId)},c=r=>{b.trim()&&(n(i.map(s=>s.columnId===r?{...s,value:b}:s)),v(null))};return Me($i,{title:"\u5217\u6570\u503C\u4FEE\u6539",placement:"right",width:840,onClose:()=>t("cancel"),open:e,closeIcon:!1,extra:k(Hi,{size:20,color:"#888888",onClick:()=>t("cancel"),className:"cursor-pointer"}),footer:Me("div",{className:"flex justify-end items-center gap-3",children:[k(ht,{mode:"default",label:"\u53D6\u6D88",onClick:()=>t("cancel")}),k(ht,{mode:"primary",label:"\u786E\u8BA4",onClick:async()=>{await t("confirm",i)}})]}),children:[Me(Rt,{gutter:16,style:{padding:"12px 18px",background:"#fafafa",borderBottom:"1px solid #f0f0f0",fontWeight:"bold"},children:[k(Qe,{span:4,children:"\u5217\u540D\u79F0"}),k(Qe,{span:20,children:"\u6570\u503C"})]}),k(Ye,{dataSource:i,renderItem:r=>k(Ye.Item,{actions:[m!==r.columnId&&k(Ai,{type:"text",icon:k(Fi,{size:14}),onClick:()=>o(r)})],children:Me("div",{style:{display:"flex",width:"100%",height:"54px",lineHeight:"54px"},children:[k("div",{style:{width:"150px",marginLeft:15},children:r.columnName}),k("div",{style:{width:"550px"},children:m===r.columnId?k(Li,{value:b,onChange:s=>g(s.target.value),onPressEnter:()=>c(r.columnId),onBlur:()=>c(r.columnId)}):k("div",{className:"w-full truncate",title:r.value,children:r.value})})]})})})]})},{confirm:ja}=Ri;function Ka({url:e,token:t,fileId:a,role:i,dbType:n,dbId:m,tableId:v,tableName:b,CustomComponents:g,eventsEmit:o,getBtnDisabled:c}){const[r,s]=be(!1),y=gi(null),[$,E]=be(),[S,I]=be(),[N,w]=be(),[A,d]=be({app:"ready",container:"ready",content:"ready"}),{getTableDataList:D,updateTableData:j,delTableDataById:z,getFileDataList:T}=Ma({url:e,token:t,role:i,eventsEmit:o});Ot(()=>{d(u=>({...u,content:"loading"})),U()},[]);const U=async()=>{try{if(n=="DirectDB"){const u=await D({dbId:m,name:b,params:{pageNo:1,pageSize:60}});u&&(u.columns=((u==null?void 0:u.columns)||[]).map(f=>({...f,id:f.id||Ke(4)})),u.dataList=(u.dataList||[]).map((f,P)=>({...f,__absIndex:P})),I(u),w(u.permission),d(f=>({...f,content:"ready"})))}else{const u=await T({fileId:a,params:{pageNo:1,pageSize:60}});u&&(u.dataList=(u.dataList||[]).map((f,P)=>({...f,__absIndex:P})),u.columns=((u==null?void 0:u.columns)||[]).map(f=>({...f,id:f.id||Ke(4)})),I(u),w(u.permission),d(f=>({...f,content:"ready"})))}}catch(u){console.log("[DatabaseApiError] getDataList:",u)}},ae=u=>((u==null?void 0:u.dataList)||[]).map(P=>{const ee=((u==null?void 0:u.columns)||[]).filter(J=>J.physicalName!=="id").map(J=>({columnId:J.id,columnName:J.businessName,physicalName:J.physicalName,value:P[J.physicalName]||"-",type:P.dataType=="DATETIME"?"date":"paragraph"}));return n=="DataTable"&&ee.push({columnId:"actions",value:"edit",label:"\u4FEE\u6539",disabled:c&&c(7,N)},{columnId:"actions",value:"delete",label:"\u5220\u9664",disabled:c&&c(4,N)}),{id:P.id,data:ee,__absIndex:P.__absIndex}}),O=u=>{const P=((u==null?void 0:u.columns)||[]).filter(H=>H.physicalName!=="id").map(H=>({title:n=="DirectDB"?H.physicalName:H.businessName,id:H.id,type:H.dataType=="DATETIME"?"date":"paragraph"}));return n=="DataTable"&&P.push({id:"actions",title:"\u64CD\u4F5C",type:"action"}),P},_=async(u,f,P)=>{var H,ee;switch(console.log("[DatabaseTableView] eventsEmit:",u,f,P),u){case"pagination:request_merge_data":{try{const M=(H=f==null?void 0:f.request)==null?void 0:H.pageNo,se=(ee=f==null?void 0:f.request)==null?void 0:ee.pageSize;if(!M||!se)return;let R;n=="DirectDB"?R=await D({dbId:m,name:b,params:{pageNo:M,pageSize:se}}):R=await T({fileId:a,params:{pageNo:M,pageSize:se}}),R&&(R.dataList=(R.dataList||[]).map((X,W)=>({...X,__absIndex:(M-1)*se+W})),R.columns=((R==null?void 0:R.columns)||[]).map(X=>({...X,id:X.id||Ke(4)})),I(X=>{var le;if(!X)return R;const W=Array.isArray(X.dataList)?X.dataList:[],re=Array.isArray(R.dataList)?R.dataList:[],ce=new Map;W.forEach(F=>ce.set(F.id,F)),re.forEach(F=>ce.set(F.id,F));const oe=Array.from(ce.values());return{...X,dataList:oe,total:X.total??R.total,columns:(le=X.columns)!=null&&le.length?X.columns:R.columns}}))}catch(M){console.log("[DatabaseApiError] pagination:request_merge_data:",M)}break}case"table_action_edit":s(!0);const J=(f.data||[]).filter(M=>M.columnId!=="actions");E({id:f.id,data:J});break;case"table_action_delete":try{ja({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await z({tableId:v,rowId:f.id})&&(yt.success("\u8868\u6570\u636E\u5220\u9664\u6210\u529F"),P.removeItem(f.id))},onCancel(){console.log("Cancel")}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break;default:o==null||o(u,f);break}},Y=async(u,f)=>{if(u=="confirm")try{const P=f.reduce((ee,J)=>(ee[J.physicalName]=J.value,ee),{});await j(v,{...P,id:$==null?void 0:$.id})&&y.current&&(yt.success("\u6570\u636E\u4FEE\u6539\u6210\u529F"),y.current.appFn.updateItem(f,$==null?void 0:$.id))}catch(P){console.log("[TableRowApiError] updateTableData:",P)}s(!1),E(void 0)},ne=Mt(()=>({label:"\u6570\u636E\u5E93\u8868\u683C",defaultActiveId:"database-table",model:null,views:[{label:"\u6570\u636E\u8868\u540D\u79F0",id:"database-table",type:"table",total:(S==null?void 0:S.totalData)||999,requestPagesize:60,viewPageSize:10,allowMultiSelect:!1,columns:O(S),viewBehavior:"pagination"}],dataSource:ae(S),eventsEmit:_}),[S,o,n,N]);return Me(bi,{title:b,goBack:()=>{o==null||o("goBack",{})},children:[k(Si,{ref:y,status:A,CustomComponents:{...g},...ne},"table-data"),$&&k(Ta,{drawerVisible:r,tableId:a,handleDrawerClose:Y,rowData:$})]})}export{Ka as default};
6
+ */const ge=me("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),he=({url:B,token:b,role:y,eventsEmit:p})=>{const i=ne.create({baseURL:B,timeout:1e6});return i.interceptors.request.use(e=>{let n=b;return!n&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(p&&p("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=n||"",e.headers.userName=y==="\u672A\u767B\u5F55\u7528\u6237"?"":y,e)}),i.interceptors.response.use(e=>{const n=["user/kaptcha"],a=e.data;if(n.some(I=>e.config.url&&e.config.url.includes(I))||a.size&&a.type)return a;const{success:u,errorMsg:c,errorCode:r}=a;return u?a:(p&&p("request:error_business",{errorCode:r,errorMsg:c||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:a}),!1)},e=>{var n,a,u,c,r,I,D,T,A;if(e.message==="canceled")return Promise.reject(e);if(p){let E="request:error_network",k={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((n=e==null?void 0:e.response)==null?void 0:n.status)===401?(E="request:error_auth",k={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(a=e==null?void 0:e.response)==null?void 0:a.data)==null?void 0:u.errorCode)==="30013"||((r=(c=e==null?void 0:e.response)==null?void 0:c.data)==null?void 0:r.errorCode)==="30023")&&(E="request:error_business",k={errorCode:(D=(I=e==null?void 0:e.response)==null?void 0:I.data)==null?void 0:D.errorCode,errorMsg:((A=(T=e==null?void 0:e.response)==null?void 0:T.data)==null?void 0:A.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),p(E,k)}return Promise.reject(e)}),{getTableDataList:async({dbId:e,name:n,params:a})=>{try{const u=await i.get(`/directDB/queryTableData/${e}/${n}?${new URLSearchParams(a).toString()}`),{success:c,data:r}=u;if(c)return r}catch(u){return console.log("getTableDataList error:",u),!1}},updateTableData:async(e,n)=>{try{const a=await i.post(`/dataTable/dataUpdateRow/${e}`,{...n}),{success:u,data:c}=a;if(u)return c}catch(a){return console.log("updateTableData error:",a),!1}},delTableDataById:async({tableId:e,rowId:n})=>{try{const a=await i.delete(`/dataTable/dataDeleteRow/${e}/${n}`),{success:u,data:c}=a;if(u)return c}catch(a){console.log("delTableDataById error:",a)}},getFileDataList:async({fileId:e,params:n})=>{try{const a=await i.get(`/dataTable/queryTableFileData/${e}?${new URLSearchParams(n).toString()}`),{success:u,data:c}=a;return u?c:!1}catch(a){return console.log("e",a),!1}}}},De=({drawerVisible:B,handleDrawerClose:b,rowData:y})=>{const[p,i]=C(y.data),[L,_]=C(null),[F,x]=C(""),e=a=>{x(a.value),_(a.columnId)},n=a=>{F.trim()&&(i(p.map(u=>u.columnId===a?{...u,value:F}:u)),_(null))};return S(oe,{title:"\u5217\u6570\u503C\u4FEE\u6539",placement:"right",width:840,onClose:()=>b("cancel"),open:B,closeIcon:!1,extra:l(fe,{size:20,color:"#888888",onClick:()=>b("cancel"),className:"cursor-pointer"}),footer:S("div",{className:"flex justify-end items-center gap-3",children:[l(J,{mode:"default",label:"\u53D6\u6D88",onClick:()=>b("cancel")}),l(J,{mode:"primary",label:"\u786E\u8BA4",onClick:async()=>{await b("confirm",p)}})]}),children:[S(ce,{gutter:16,style:{padding:"12px 18px",background:"#fafafa",borderBottom:"1px solid #f0f0f0",fontWeight:"bold"},children:[l(V,{span:4,children:"\u5217\u540D\u79F0"}),l(V,{span:20,children:"\u6570\u503C"})]}),l(U,{dataSource:p,renderItem:a=>l(U.Item,{actions:[L!==a.columnId&&l(re,{type:"text",icon:l(ge,{size:14}),onClick:()=>e(a)})],children:S("div",{style:{display:"flex",width:"100%",height:"54px",lineHeight:"54px"},children:[l("div",{style:{width:"150px",marginLeft:15},children:a.columnName}),l("div",{style:{width:"550px"},children:L===a.columnId?l(ie,{value:F,onChange:u=>x(u.target.value),onPressEnter:()=>n(a.columnId),onBlur:()=>n(a.columnId)}):l("div",{className:"w-full truncate",title:a.value,children:a.value})})]})})})]})},{confirm:be}=le;function Be({url:B,token:b,fileId:y,role:p,dbType:i,dbId:L,tableId:_,tableName:F,CustomComponents:x,eventsEmit:e,getBtnDisabled:n}){const[a,u]=C(!1),c=te(null),[r,I]=C(),[D,T]=C(),[A,E]=C(),[k,M]=C({app:"ready",container:"ready",content:"ready"}),{getTableDataList:v,updateTableData:O,delTableDataById:W,getFileDataList:$}=he({url:B,token:b,role:p,eventsEmit:e});se(()=>{M(t=>({...t,content:"loading"})),X()},[]);const X=async()=>{try{if(i=="DirectDB"){const t=await v({dbId:L,name:F,params:{pageNo:1,pageSize:60}});t&&(t.columns=((t==null?void 0:t.columns)||[]).map(s=>({...s,id:s.id||z(4)})),t.dataList=(t.dataList||[]).map((s,o)=>({...s,__absIndex:o})),T(t),E(t.permission),M(s=>({...s,content:"ready"})))}else{const t=await $({fileId:y,params:{pageNo:1,pageSize:60}});t&&(t.dataList=(t.dataList||[]).map((s,o)=>({...s,__absIndex:o})),t.columns=((t==null?void 0:t.columns)||[]).map(s=>({...s,id:s.id||z(4)})),T(t),E(t.permission),M(s=>({...s,content:"ready"})))}}catch(t){console.log("[DatabaseApiError] getDataList:",t)}},G=t=>((t==null?void 0:t.dataList)||[]).map(o=>{const w=((t==null?void 0:t.columns)||[]).filter(g=>g.physicalName!=="id").map(g=>({columnId:g.id,columnName:g.businessName,physicalName:g.physicalName,value:o[g.physicalName]||"-",type:o.dataType=="DATETIME"?"date":"paragraph"}));return i=="DataTable"&&w.push({columnId:"actions",value:"edit",label:"\u4FEE\u6539",disabled:n&&n(7,A)},{columnId:"actions",value:"delete",label:"\u5220\u9664",disabled:n&&n(4,A)}),{id:o.id,data:w,__absIndex:o.__absIndex}}),K=t=>{const o=((t==null?void 0:t.columns)||[]).filter(f=>f.physicalName!=="id").map(f=>({title:i=="DirectDB"?f.physicalName:f.businessName,id:f.id,type:f.dataType=="DATETIME"?"date":"paragraph"}));return i=="DataTable"&&o.push({id:"actions",title:"\u64CD\u4F5C",type:"action"}),o},Q=async(t,s,o)=>{var f,w;switch(console.log("[DatabaseTableView] eventsEmit:",t,s,o),t){case"pagination:request_merge_data":{try{const h=(f=s==null?void 0:s.request)==null?void 0:f.pageNo,q=(w=s==null?void 0:s.request)==null?void 0:w.pageSize;if(!h||!q)return;let d;i=="DirectDB"?d=await v({dbId:L,name:F,params:{pageNo:h,pageSize:q}}):d=await $({fileId:y,params:{pageNo:h,pageSize:q}}),d&&(d.dataList=(d.dataList||[]).map((m,P)=>({...m,__absIndex:(h-1)*q+P})),d.columns=((d==null?void 0:d.columns)||[]).map(m=>({...m,id:m.id||z(4)})),T(m=>{var j;if(!m)return d;const P=Array.isArray(m.dataList)?m.dataList:[],ee=Array.isArray(d.dataList)?d.dataList:[],R=new Map;P.forEach(N=>R.set(N.id,N)),ee.forEach(N=>R.set(N.id,N));const ae=Array.from(R.values());return{...m,dataList:ae,total:m.total??d.total,columns:(j=m.columns)!=null&&j.length?m.columns:d.columns}}))}catch(h){console.log("[DatabaseApiError] pagination:request_merge_data:",h)}break}case"table_action_edit":u(!0);const g=(s.data||[]).filter(h=>h.columnId!=="actions");I({id:s.id,data:g});break;case"table_action_delete":try{be({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await W({tableId:_,rowId:s.id})&&(H.success("\u8868\u6570\u636E\u5220\u9664\u6210\u529F"),o.removeItem(s.id))},onCancel(){console.log("Cancel")}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break;default:e==null||e(t,s);break}},Y=async(t,s)=>{if(t=="confirm")try{const o=s.reduce((w,g)=>(w[g.physicalName]=g.value,w),{});await O(_,{...o,id:r==null?void 0:r.id})&&c.current&&(H.success("\u6570\u636E\u4FEE\u6539\u6210\u529F"),c.current.appFn.updateItem(s,r==null?void 0:r.id))}catch(o){console.log("[TableRowApiError] updateTableData:",o)}u(!1),I(void 0)},Z=ue(()=>({label:"\u6570\u636E\u5E93\u8868\u683C",defaultActiveId:"database-table",model:null,views:[{label:"\u6570\u636E\u8868\u540D\u79F0",id:"database-table",type:"table",total:(D==null?void 0:D.totalData)||999,requestPagesize:60,viewPageSize:10,allowMultiSelect:!1,columns:K(D),viewBehavior:"pagination"}],dataSource:G(D),eventsEmit:Q}),[D,e,i,A]);return S(de,{title:F,goBack:()=>{e==null||e("goBack",{})},children:[l(pe,{ref:c,status:k,CustomComponents:{...x},...Z},"table-data"),r&&l(De,{drawerVisible:a,tableId:y,handleDrawerClose:Y,rowData:r})]})}export{Be as default};