@gientech/modual 2.1.1 → 2.1.3

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.
@@ -1,4 +1,4 @@
1
- var zn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in m?zn(m,a,{enumerable:!0,configurable:!0,writable:!0,value:A}):m[a]=A;var ee=(m,a,A)=>Gn(m,typeof a!="symbol"?a+"":a,A),an=(m,a,A)=>a.has(m)||Sn("Cannot "+A);var R=(m,a,A)=>(an(m,a,"read from private field"),A?A.call(m):a.get(m)),Ot=(m,a,A)=>a.has(m)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(m):a.set(m,A),It=(m,a,A,f)=>(an(m,a,"write to private field"),f?f.call(m,A):a.set(m,A),A),Dt=(m,a,A)=>(an(m,a,"access private method"),A);var on=(m,a,A,f)=>({set _(_){It(m,a,_,A)},get _(){return R(m,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{a as createLucideIcon,a7 as getAugmentedNamespace,d as dt$1,b as axios}from"./index-BRq6VK9v.js";import{L as L6,X as Xs}from"./index-CJZ9OITS.js";import{c as ChevronRight}from"./index-md7-ni21.js";import{X}from"./x-D-pV1NCt.js";/**
1
+ var zn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in m?zn(m,a,{enumerable:!0,configurable:!0,writable:!0,value:A}):m[a]=A;var ee=(m,a,A)=>Gn(m,typeof a!="symbol"?a+"":a,A),an=(m,a,A)=>a.has(m)||Sn("Cannot "+A);var R=(m,a,A)=>(an(m,a,"read from private field"),A?A.call(m):a.get(m)),Ot=(m,a,A)=>a.has(m)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(m):a.set(m,A),It=(m,a,A,f)=>(an(m,a,"write to private field"),f?f.call(m,A):a.set(m,A),A),Dt=(m,a,A)=>(an(m,a,"access private method"),A);var on=(m,a,A,f)=>({set _(_){It(m,a,_,A)},get _(){return R(m,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{a as createLucideIcon,a7 as getAugmentedNamespace,d as dt$1,b as axios}from"./index-BRq6VK9v.js";import{L as L6,X as Xs}from"./index-CWcCPHu2.js";import{c as ChevronRight}from"./index-BTCYmc0f.js";import{X}from"./x-D-pV1NCt.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,6 @@
1
+ import{jsx as a,jsxs as O,Fragment as he}from"react/jsx-runtime";import*as j from"react";import{isValidElement as $e,useMemo as ie,useState as h,useRef as Ce,useCallback as ue,useEffect as xe}from"react";import{u as Ve}from"./index-CpW6Dhpp.js";import{F as Pe,J as K,C as Re,T as je,U as We,m as Ue}from"./index-BTCYmc0f.js";import{a as He,g as Ge,m as Ze,$ as qe,a0 as Ye,r as Ke,a1 as Xe,a2 as Je,a3 as Qe,l as et,f as le,a4 as tt,u as ut,a5 as at,T as ce,Z as st,o as ot,M as nt,b as rt,a6 as it,i as be}from"./index-BRq6VK9v.js";import{O as we}from"./index-D7gMvbtf.js";/* empty css */import{s as Y,M as ye}from"./style-BXl32bWg.js";import{q as ke}from"./index-CWcCPHu2.js";import{D as Ie}from"./index-DKwGCqM2.js";import{X as ge}from"./x-D-pV1NCt.js";import"react-dom";import{B as De,T as Te}from"./index-BfDZSwG3.js";/**
2
+ * @license lucide-react v0.456.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const lt=He("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),de=e=>e?typeof e=="function"?e():e:null,ct=e=>{const{componentCls:r,popoverColor:o,titleMinWidth:s,fontWeightStrong:i,innerPadding:p,boxShadowSecondary:S,colorTextHeading:m,borderRadiusLG:_,zIndexPopup:B,titleMarginBottom:b,colorBgElevated:E,popoverBg:F,titleBorderBottom:L,innerContentPadding:$,titlePadding:x}=e;return[{[r]:Object.assign(Object.assign({},Ke(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:B,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:["var(--valid-offset-x, 50%)","var(--arrow-y, 50%)"].join(" "),"--antd-arrow-background-color":E,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${r}-content`]:{position:"relative"},[`${r}-inner`]:{backgroundColor:F,backgroundClip:"padding-box",borderRadius:_,boxShadow:S,padding:p},[`${r}-title`]:{minWidth:s,marginBottom:b,color:m,fontWeight:i,borderBottom:L,padding:x},[`${r}-inner-content`]:{color:o,padding:$}})},Ye(e,"var(--antd-arrow-background-color)"),{[`${r}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${r}-content`]:{display:"inline-block"}}}]},dt=e=>{const{componentCls:r}=e;return{[r]:Xe.map(o=>{const s=e[`${o}6`];return{[`&${r}-${o}`]:{"--antd-arrow-background-color":s,[`${r}-inner`]:{backgroundColor:s},[`${r}-arrow`]:{background:"transparent"}}}})}},pt=e=>{const{lineWidth:r,controlHeight:o,fontHeight:s,padding:i,wireframe:p,zIndexPopupBase:S,borderRadiusLG:m,marginXS:_,lineType:B,colorSplit:b,paddingSM:E}=e,F=o-s,L=F/2,$=F/2-r,x=i;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:S+30},Je(e)),Qe({contentRadius:m,limitVerticalRadius:!0})),{innerPadding:p?0:12,titleMarginBottom:p?0:_,titlePadding:p?`${L}px ${x}px ${$}px`:0,titleBorderBottom:p?`${r}px ${B} ${b}`:"none",innerContentPadding:p?`${E}px ${x}px`:0})},Se=Ge("Popover",e=>{const{colorBgElevated:r,colorText:o}=e,s=Ze(e,{popoverBg:r,popoverColor:o});return[ct(s),dt(s),qe(s,"zoom-big")]},pt,{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var mt=function(e,r){var o={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&r.indexOf(s)<0&&(o[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)r.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(o[s[i]]=e[s[i]]);return o};const Me=({title:e,content:r,prefixCls:o})=>!e&&!r?null:j.createElement(j.Fragment,null,e&&j.createElement("div",{className:`${o}-title`},e),r&&j.createElement("div",{className:`${o}-inner-content`},r)),Ft=e=>{const{hashId:r,prefixCls:o,className:s,style:i,placement:p="top",title:S,content:m,children:_}=e,B=de(S),b=de(m),E=le(r,o,`${o}-pure`,`${o}-placement-${p}`,s);return j.createElement("div",{className:E,style:i},j.createElement("div",{className:`${o}-arrow`}),j.createElement(tt,Object.assign({},e,{className:r,prefixCls:o}),_||j.createElement(Me,{prefixCls:o,title:B,content:b})))},ft=e=>{const{prefixCls:r,className:o}=e,s=mt(e,["prefixCls","className"]),{getPrefixCls:i}=j.useContext(et),p=i("popover",r),[S,m,_]=Se(p);return S(j.createElement(Ft,Object.assign({},s,{prefixCls:p,hashId:m,className:le(o,_)})))};var Ct=function(e,r){var o={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&r.indexOf(s)<0&&(o[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)r.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(o[s[i]]=e[s[i]]);return o};const gt=j.forwardRef((e,r)=>{var o,s;const{prefixCls:i,title:p,content:S,overlayClassName:m,placement:_="top",trigger:B="hover",children:b,mouseEnterDelay:E=.1,mouseLeaveDelay:F=.1,onOpenChange:L,overlayStyle:$={},styles:x,classNames:M}=e,t=Ct(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:n,className:c,style:l,classNames:A,styles:D}=ut("popover"),y=n("popover",i),[C,W,G]=Se(y),Z=n(),q=le(m,W,G,c,A.root,M==null?void 0:M.root),se=le(A.body,M==null?void 0:M.body),[oe,ne]=at(!1,{value:(o=e.open)!==null&&o!==void 0?o:e.visible,defaultValue:(s=e.defaultOpen)!==null&&s!==void 0?s:e.defaultVisible}),X=(P,J)=>{ne(P,!0),L==null||L(P,J)},re=P=>{P.keyCode===nt.ESC&&X(!1,P)},ae=P=>{X(P)},Q=de(p),ee=de(S);return C(j.createElement(ce,Object.assign({placement:_,trigger:B,mouseEnterDelay:E,mouseLeaveDelay:F},t,{prefixCls:y,classNames:{root:q,body:se},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},D.root),l),$),x==null?void 0:x.root),body:Object.assign(Object.assign({},D.body),x==null?void 0:x.body)},ref:r,open:oe,onOpenChange:ae,overlay:Q||ee?j.createElement(Me,{prefixCls:y,title:Q,content:ee}):null,transitionName:st(Z,"zoom-big",t.transitionName),"data-popover-inject":!0}),ot(b,{onKeyDown:P=>{var J,te;$e(b)&&((te=b==null?void 0:(J=b.props).onKeyDown)===null||te===void 0||te.call(J,P)),re(P)}})))}),Ne=gt;Ne._InternalPanelDoNotUseOrYouWillBeFired=ft;const Et="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",yt="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",ze=({url:e,token:r,role:o,eventsEmit:s})=>{const i=rt.create({baseURL:e,timeout:1e6});return i.interceptors.request.use(t=>{let n=r;return!n&&!["user/login","user/kaptcha","user/regist"].some(l=>t.url.includes(l))?(s&&s("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=n||"",t.headers.userName=o==="\u672A\u767B\u5F55\u7528\u6237"?"":o,t)}),i.interceptors.response.use(t=>{const n=["user/kaptcha"],c=t.data;if(n.some(y=>t.config.url&&t.config.url.includes(y))||c.size&&c.type)return c;const{success:l,errorMsg:A,errorCode:D}=c;if(l)return c;s&&s("request:error_business",{errorCode:D,errorMsg:A||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:c})},t=>{var n,c,l,A,D,y,C,W,G;if(t.message==="canceled")return Promise.reject(t);if(s){let Z="request:error_network",q={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:t};((n=t==null?void 0:t.response)==null?void 0:n.status)===401?(Z="request:error_auth",q={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:t,redirect:"/login"}):(((l=(c=t==null?void 0:t.response)==null?void 0:c.data)==null?void 0:l.errorCode)==="30013"||((D=(A=t==null?void 0:t.response)==null?void 0:A.data)==null?void 0:D.errorCode)==="30023")&&(Z="request:error_business",q={errorCode:(C=(y=t==null?void 0:t.response)==null?void 0:y.data)==null?void 0:C.errorCode,errorMsg:((G=(W=t==null?void 0:t.response)==null?void 0:W.data)==null?void 0:G.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:t}),s(Z,q)}return Promise.reject(t)}),{getTableList:async t=>{try{const n=await i.get(`/directDB/queryTableList/${t}`),{success:c,data:l}=n;if(c)return l}catch(n){console.log("getTableList error:",n)}},getTableTreeList:async t=>{try{const n=await i.get(`/dataTable/queryTableFileTreeList/${t}`),{success:c,data:l}=n;if(c)return l}catch(n){console.log("getTableTreeList error:",n)}},getDBDetailById:async(t,n)=>{const c=Be(n);try{const l=await i.get(`/${c}/queryDBInfo/${t}`),{success:A,data:D}=l;if(A)return D}catch(l){console.log("getDBDetailById error:",l)}},delTableById:async(t,n)=>{const c=Be(n);try{const l=await i.delete(`/${c}/deleteTable/${t}`),{success:A,data:D}=l;if(A)return D}catch(l){console.log("delTableById error:",l)}},delFileById:async t=>{try{const n=await i.delete(`/dataTable/deleteTableFileData/${t}`),{success:c,data:l}=n;if(c)return l}catch(n){console.log("delFileById",n)}},parseFiles:async({fileIds:t,isGenDescription:n,tableDescriptionMap:c})=>{try{const l=await i.post("/dataTable/parseFiles",{fileIds:t,isGenDescription:n,tableDescriptionMap:c}),{success:A,data:D}=l;if(A)return D}catch(l){console.log("parseFiles error:",l)}},reParseFile:async t=>{try{const n=await i.post(`/dataTable/reParseFile/${t}`),{success:c,data:l}=n;if(c)return l}catch(n){console.log("reParseFile error:",n)}},parseAppendFile:async({fileIds:t,tableId:n})=>{try{const c=await i.post("/dataTable/parseAppendFiles",{fileIds:t,tableId:n}),{success:l,data:A}=c;if(l)return A}catch(c){console.log("parseAppendFile error:",c)}},deleteUploadedFiles:async t=>{try{const n=await i.post("/dataTable/cancelUploadFile",{fileIds:t}),{success:c,data:l}=n;if(c)return l}catch(n){console.log("deleteUploadedFiles error:",n)}},getTableInfoById:async t=>{try{const n=await i.get(`/dataTable/queryTableMeta/${t}`),{success:c,data:l}=n;if(c)return l}catch(n){console.log("getTableInfoById error:",n)}},updateTableInfo:async({tableId:t,description:n,businessName:c})=>{try{const l=await i.post("/dataTable/updateTableInfo",{tableId:t,businessName:c,description:n}),{success:A,data:D}=l;if(A)return D}catch(l){console.log("updateTableInfo error:",l)}},optimizeDesc:async t=>{try{const n=await i.get(`/genTableDescription/${t}`),{success:c,data:l}=n;if(c)return l}catch(n){console.log("optimizeDesc error:",n)}}}},Be=e=>e=="DataTable"?"dataTable":"directDB",me='<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',ht={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},bt=({drawerTitle:e,drawerVisible:r,uploadUrl:o,handleDrawerClose:s,dbId:i,tableInfo:p,token:S,url:m,role:_})=>{const B=ie(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!p,accept:".csv,.xlsx,.xls",maxFiles:p?1:20,url:o,autoUpload:!0,headers:{Authorization:S},queryParams:{databaseId:i,...p&&{tableId:p.tableId}},placeholder:O("div",{children:[a("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),O("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[a("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),a("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"}),a("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"}),a("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:p?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:a("img",{src:yt,width:40}),itemStatus:{pending:a("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:a("span",{style:{fontSize:"12px",color:"#007bff"}}),success:a("span",{style:{fontSize:"12px",color:"#10b981"}}),error:a("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:a(Pe,{size:20,style:{color:"#6b7280"}})}},...!p&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:a("img",{src:Et}),mode:"text",onClick:()=>{l(!0)}}]},...!p&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[p]),[b,E]=h(!1),[F,L]=h({}),$=Ce(null),[x,M]=h(!1),[t,n]=h([]),[c,l]=h(!1),[A,D]=h(me),[y,C]=h(null),[W,G]=h(me),[Z,q]=h(0),{parseFiles:se,parseAppendFile:oe,deleteUploadedFiles:ne}=ze({url:m,token:S,role:_}),X=ue(async(g,f,V)=>{var w;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",g,f),g){case"form:ready":f.formRef?$.current=f.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":ae();break;case"form_field_change":L(k=>({...k,[f.fieldId]:f.value}));break;case"uploader:error":(w=f.item)!=null&&w.id?n(k=>[{id:f.item.id,status:f.item.status},...k]):Y.error(f==null?void 0:f.message);break;case"uploader:success":n(k=>[{id:f.item.id,status:f.item.status},...k]);break;case"uploader:remove":const U=f.item.status;n(k=>k.filter(d=>d.id!==f.item.id)),U=="success"&&await ee([f.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",g)}},[]),re=ie(()=>({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:B.formWidth,formConfig:{layout:B.layout,showReset:!1,showSubmit:!1,formWidth:B.formWidth,getFormData:()=>({...F,timestamp:new Date().toISOString(),formId:B.id}),onFieldChange:(g,f)=>{X("form_field_change",{fieldId:g,value:f},void 0)},onValidationError:g=>{X("form_validation_error",g,void 0)}}}],dataSource:[{id:B.id,fields:B.fields,defaultValues:{}}],eventsEmit:X,styles:{theme:ht}}),[p,B]),ae=async()=>{var g;try{E(!0);const f=await $.current.getAllData();if(f.isValid){const V=(g=f.fields.find(w=>w.name=="fileIds"))==null?void 0:g.value;if(Array.isArray(V)&&(V==null?void 0:V.length)>0){let w;if(p)w=await oe({fileIds:V.map(U=>U.uploadApiRes),tableId:p.id});else{const U={fileIds:V.map(k=>k.uploadApiRes),tableDescriptionMap:V.reduce((k,d)=>(k[d.uploadApiRes]=d.formData.description,k),{}),isGenDescription:x};w=await se(U)}w&&s("refresh")}}}catch(f){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",f)}finally{s(),E(!1),M(!1)}},Q=async g=>{var f;try{const V=await $.current.getAllData();if(V.isValid){const w=(f=V.fields.find(U=>U.name=="fileIds"))==null?void 0:f.value;if(w&&Array.isArray(w)&&(w==null?void 0:w.length)>0){const U=w.map(d=>d.uploadApiRes),k=await ee(U)}}}catch(V){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",V)}finally{n([]),s(),M(!1)}},ee=async g=>{try{const f=await ne(g);if(f)return f}catch(f){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",f)}},P=g=>{M(g)},J=ue(g=>{D(g),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",g)},[]),te=ue(g=>{C(()=>g),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),pe=ue(async()=>{try{if(!y){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const g=y("pure_string");await navigator.clipboard.writeText(g),Y.success("\u5DF2\u590D\u5236",1)}catch(g){console.error("\u590D\u5236\u5931\u8D25:",g)}finally{l(!1)}},[y]);return O(Ie,{title:e,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:a(ge,{size:20,color:"#888888",onClick:()=>Q(),className:"cursor-pointer"}),open:r,destroyOnHidden:!0,footer:O("div",{className:"flex items-center",style:{justifyContent:p?"end":"space-between"},children:[!p&&O("div",{className:"flex gap-2 items-center",children:[a("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",a(ce,{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:a(Re,{size:14})}),a(it,{onChange:P})]}),O("div",{className:"flex self-end gap-3",children:[a(K,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:Q}),a(K,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:b,disabled:t.some(g=>g.status=="error"),onClick:async()=>{await ae()}})]})]}),children:[a(we,{...re},"upload-file"),a(ye,{title:O("div",{children:["\u6A21\u7248",a("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:c,onCancel:()=>l(!1),footer:O("div",{className:"flex justify-end items-center gap-3",children:[a(K,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{G(me),q(g=>g+1)}}),a(K,{mode:"primary",label:"\u590D\u5236",onClick:pe})]}),children:a(ke,{data:W,onChange:J,onGetData:te,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"}}},Z)})]})},Dt="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",Bt="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:At}=ye,vt='<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',xt=({drawerTitle:e,drawerVisible:r,tableInfo:o,handleDrawerClose:s,optimizeDesc:i,eventsEmit:p})=>{const S=ie(()=>(o==null?void 0:o.data.find(C=>C.columnId=="name").value)||"-",[o]),[m,_]=h(""),[B,b]=h(null),[E,F]=h(""),[L,$]=h(0),[x,M]=h(!1),[t,n]=h(!1);xe(()=>{const C=(o==null?void 0:o.data.find(W=>W.columnId=="description").value)||"-";F(C)},[o]);const c=()=>{At({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(){F(vt),$(C=>C+1)},onCancel(){console.log("Cancel")}})},l=ue(C=>{_(C),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",C)},[]),A=ue(C=>{b(()=>C),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),D=async()=>{try{M(!0);const C=await i(o.tableId);C&&(F(C),$(W=>W+1),M(!1))}catch{Y.error("AI \u4F18\u5316\u5931\u8D25")}},y=ue(()=>{if(!B){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const C=B("pure_string");p("table_info:update",C)},[B,p]);return O(Ie,{title:e,placement:"right",width:720,onClose:s,closeIcon:!1,extra:a(ge,{size:20,color:"#888888",onClick:s,className:"cursor-pointer"}),open:r,destroyOnHidden:!0,footer:a("div",{className:"flex items-center",style:{justifyContent:"end"},children:O("div",{className:"flex self-end gap-3",children:[a(K,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:s}),a(K,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>y(),disabled:x})]})}),children:[a("div",{className:"mb-[10px] font-bold",children:S}),O("div",{className:"mb-[10px]",children:[a("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),a("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),a("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)"})]}),a(ke,{data:E,onChange:l,onGetData:A,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"}}},L),O("div",{children:[a(Ne,{open:t,onOpenChange:C=>n(!!C),content:a("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:c,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:O("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[a("div",{className:"text-[16px]",children:"\u6A21\u7248"}),a(ge,{size:20,color:"#888888",onClick:()=>n(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:C=>C,children:a("span",{children:a(K,{mode:"text",icon:a("img",{src:Dt}),children:"\u4F7F\u7528\u6A21\u7248"})})}),a(K,{onClick:D,mode:"text",icon:a("img",{src:Bt}),loading:x,children:"AI\u4F18\u5316"})]})]})},wt=""+new URL("empty.png",import.meta.url).href;var H=(e=>(e[e.DATE=0]="DATE",e[e.VIEW=1]="VIEW",e[e.ERROR=2]="ERROR",e[e.AUTHORIZE=3]="AUTHORIZE",e[e.DELETE=4]="DELETE",e[e.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",e[e.DOWNLOAD=6]="DOWNLOAD",e[e.EDIT=7]="EDIT",e[e.ADD=8]="ADD",e[e.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",e[e.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",e))(H||{}),Ee=(e=>(e.GENERATING="generating",e.SUCCESS="success",e.FAIL="fail",e))(Ee||{});const Fe={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},kt=e=>typeof e=="string"&&e in Fe?Fe[e]:Fe.default,fe=e=>{const{value:r,cell:o}=e;switch(o.columnId){case"importstatus":return r?a(ce,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:a(je,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):a(he,{});case"status":const s=kt(e.cell.statusType);return r=="\u5BFC\u5165\u5931\u8D25"?a(ce,{title:o.errorMsg,children:O("div",{className:"flex items-center gap-2",children:[a(De,{color:s,text:r}),a(Te,{size:14,color:"red"})]})}):a(De,{color:s,text:r});default:return a(he,{})}},Ae=[{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"}],It=e=>{var s,i;const{cell:r,value:o}=e;return typeof o=="string"?a("div",{title:o,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o}):(s=r.tableMeta)!=null&&s.isGenDescription&&((i=r.tableMeta)==null?void 0:i.generateDescriptionStatus)=="generating"?O("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[a("span",{children:"\u751F\u6210\u4E2D"}),a(lt,{size:14})]}):"-"},Tt=({dbInfo:e,setDrawerTitle:r,setDrawerVisible:o,getBtnDisabled:s})=>O("div",{className:"flex flex-col items-center justify-center h-full",children:[a("div",{className:"text-xl font-semibold mb-3",children:a("img",{src:wt,width:120})}),a("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),a("div",{className:"flex gap-3",children:a(K,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:s&&s(8,e==null?void 0:e.permission),onClick:()=>{r("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),o(!0)}})})]}),{confirm:ve}=ye,Ut=e=>{const{url:r,token:o,role:s,id:i,dbType:p,CustomComponents:S,getBtnDisabled:m,uploadUrl:_}=e,[B,b]=h({container:"ready",content:"ready"}),E=Ce(null),F=Ce(null),[L,$]=h(),[x,M]=h({}),[t,n]=h(),[c,l]=h(!1),[A,D]=h(""),[y,C]=h(),[W,G]=h(!1),[Z,q]=h(""),{getTableList:se,delTableById:oe,delFileById:ne,updateTableInfo:X,optimizeDesc:re,getTableTreeList:ae,reParseFile:Q,getDBDetailById:ee}=ze({url:r,token:o,role:s,eventsEmit:e.eventsEmit});xe(()=>(i&&p&&(b(d=>({...d,container:"loading"})),P()),()=>{F.current&&(clearTimeout(F.current),F.current=null)}),[i,p]);const P=async()=>{try{const d=await ee(i,p);d&&(n(d),b(u=>({...u,container:"ready",content:"loading"})))}catch(d){console.log("[TableApiError] getDBInfo:",d)}await k()},J=async()=>{try{if(p=="DirectDB"){const d=await se(i);if(d){const u=pe(d);return $(u||[]),b(R=>({...R,content:"ready"})),u||[]}else b(u=>({...u,content:"error"}))}else{const d=await ae(i);if(d){const u=te(d);return $(u||[]),b(R=>({...R,content:"ready"})),u||[]}else b(u=>({...u,content:"error"}))}}catch(d){console.log("[TableApiError] getTableList:",d)}};function te(d){return(d||[]).map((u,R)=>{var I,z;let v=Ae.find(T=>T.status==u.status);const N=u.children.some(T=>T.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:(I=u==null?void 0:u.tableMeta)==null?void 0:I.description,type:"customized",tableMeta:u==null?void 0:u.tableMeta},{columnId:"count",value:`${u.rowCount}\u884C\uFF0C${u.columnCount}\u5217`,type:"text"},{columnId:"status",...v,type:"customized",errorMsg:u.errorMsg},{columnId:"importstatus",value:N,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:m&&m(H.VIEW,u.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:m&&m(H.EDIT,u.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:m&&m(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:m&&m(H.DELETE,u.permission)}],expanded:!1,...u.children&&((z=u.children)==null?void 0:z.length)>0&&{children:[...(u.children||[]).map(T=>{const Oe=Ae.find(Le=>Le.status==T.status),_e=[{columnId:"name",value:T.originalFilename,type:"text"},{columnId:"count",value:`${T.rowCount}\u884C\uFF0C${T.columnCount}\u5217`,type:"text"},{columnId:"status",...Oe,errorMsg:T.errorMsg,type:"customized"},{columnId:"createdAt",value:T.gmtCreate,type:"date"},{columnId:"updatedAt",value:T.gmtModified,type:"date"},...T.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:m&&m(H.VIEW,T.permission)}]:[],...T.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:m&&m(H.ADD,T.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:m&&m(H.DELETE,T.permission)}];return{id:T.fileId.toString(),tableId:T.tableId,data:_e}})]}}})}function pe(d){return(d||[]).map((u,R)=>({id:u.id||Ve(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:m&&m(H.VIEW,u.permission)}]}))}async function g(d,u,R){switch(console.log("[adopter] mergedEventsEmit",d,u,R),d){case"table_action_delete":{try{if(console.log("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E:",u),!u||!u.tableId&&!u.id){console.error("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E\u4E0D\u5B8C\u6574:",u),Y.error("\u5220\u9664\u5931\u8D25\uFF1A\u6570\u636E\u4E0D\u5B8C\u6574");return}const v=u.tableId||u.id,N=u.id;ve({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:a(Te,{color:"#FF4D4F",className:"mr-[8px]"}),okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await oe(v,p)&&(E!=null&&E.current)?(E==null||E.current.appFn.removeItem(N),Y.success("\u5220\u9664\u6210\u529F")):Y.error("\u5220\u9664\u5931\u8D25")}})}catch(v){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25:",v),Y.error("\u5220\u9664\u5931\u8D25")}break}case"table_action_edit":{q("\u4FEE\u6539\u6570\u636E\u914D\u7F6E"),G(!0),C(u);break}case"toolbar_upload":{D("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),l(!0);break}case"table_action_addData":{D("\u8FFD\u52A0\u6570\u636E"),l(!0),C(u);break}case"table_action_reValidate":{await Q(u.id)&&(F.current&&(clearTimeout(F.current),F.current=null),await k());break}case"table_info:update":{try{if(y!=null&&y.id){const v=(y==null?void 0:y.data.find(I=>I.columnId=="name").value)||"-";if(await X({tableId:y.tableId,description:u,businessName:v})&&(E!=null&&E.current)){const I={...y,data:y.data.map(z=>z.columnId=="description"?{...z,value:u}:z)};E==null||E.current.appFn.updateItem(I,y.id),Y.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(v){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",v)}finally{w()}break}case"table_action_delete_sub":{try{ve({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:v,tableId:N}=u;await ne(u.id)&&(E!=null&&E.current)&&(M(z=>({...z,[N]:[...z[N]||[],v]})),u.data.find(z=>z.status=="00")&&(F.current&&(clearTimeout(F.current),F.current=null),k()),R.removeItem(v,N),Y.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 e.eventsEmit=="function"&&e.eventsEmit("toolbar_auth",t);break}default:typeof e.eventsEmit=="function"&&e.eventsEmit(d,u);break}}const f=ie(()=>({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"}]}]}),[L,p]),V=ie(()=>({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:a(It,{}),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:a(fe,{})},{id:"importstatus",title:"\u8FFD\u52A0\u63D0\u793A",type:"customized",component:a(fe,{})},{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:m&&m(H.ADD,t==null?void 0:t.permission),icon:a(We,{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:a(fe,{})},{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:x,onSubTableRowAnimationComplete:(d,u)=>{M(R=>({...R,[d]:(R[d]||[]).filter(v=>v!==u)}))}}),[x,L,p,t]),w=d=>{l(!1),G(!1),C(void 0),d=="refresh"&&(F.current&&(clearTimeout(F.current),F.current=null),k())};function U(d){var u,R;if(!Array.isArray(d))return!0;for(const v of d){if(v.data){const N=v.data.find(z=>z.columnId==="status"),I=v.data.find(z=>z.columnId==="description");if(console.log("+++++",N.status==="20"||N.status==="11"||((u=I==null?void 0:I.tableMeta)==null?void 0:u.generateDescriptionStatus)==Ee.GENERATING),N&&(N.status==="20"||N.status==="11"||((R=I==null?void 0:I.tableMeta)==null?void 0:R.generateDescriptionStatus)==Ee.GENERATING))return!1}if(Array.isArray(v.children)){for(const N of v.children)if(N.data){const I=N.data.find(z=>z.columnId==="status");if(I&&(I.status==="20"||I.status==="11"))return!1}}}return!0}const k=async()=>{const d=await J();U(d||[])?F.current&&(clearTimeout(F.current),F.current=null):(F.current&&(clearTimeout(F.current),F.current=null),F.current=setTimeout(()=>{k()},5e3))};return O(Ue,{title:t==null?void 0:t.name,description:(t==null?void 0:t.description)||"-",goBack:()=>{var d;(d=e.eventsEmit)==null||d.call(e,"goBack",{})},children:[a(we,{dataSource:L,ref:E,eventsEmit:g,status:B,styles:{theme:{...be,colors:{...be.colors,tableFirstColumnBg:"#ffffff",tableLastColumnBg:"#ffffff",paginationBackground:"#ffffff",subTableBackground:"#F5F5F5",tableHeaderBg:"#F5F5F5"}},mode:"light"},CustomComponents:{EmptyData:()=>a(Tt,{dbInfo:t,setDrawerTitle:D,setDrawerVisible:l,getBtnDisabled:m}),...S},...p=="DataTable"?V:f}),a(bt,{drawerTitle:A,drawerVisible:c,handleDrawerClose:w,dbId:i,token:o,url:r,uploadUrl:_,role:s,tableInfo:y}),a(xt,{drawerTitle:Z,drawerVisible:W,handleDrawerClose:w,tableInfo:y,optimizeDesc:re,eventsEmit:g})]})};export{Ut as D,Ne as P};