@gientech/modual 2.2.0 → 2.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/README.md +761 -761
- package/assets/{GientechStreamReader-C5jijqVw.js → GientechStreamReader-OCXcOLQC.js} +1 -1
- package/assets/{LeftOutlined-9XTSYGbi.js → LeftOutlined-DZMeGbKk.js} +1 -1
- package/assets/database.svg +11 -11
- package/assets/database_add.svg +53 -53
- package/assets/database_connect.svg +66 -66
- package/assets/database_upload.svg +29 -29
- package/assets/databse.svg +6 -6
- package/assets/defaultWeLogo.svg +14 -14
- package/assets/graph.svg +4 -4
- package/assets/iconAi.svg +9 -9
- package/assets/{index-BxR_BLxA.js → index-97Oe7YBe.js} +1 -1
- package/assets/{index-DaM9Fbys.js → index-B4k3tK0f.js} +1 -1
- package/assets/index-BIEKgWu0.js +27 -0
- package/assets/{index-B64Nj5uU.js → index-CGHHoZNS.js} +2 -2
- package/assets/index-CzZQWA2P.js +1 -0
- package/assets/{index-BvpN2hYX.js → index-DHK_n74G.js} +2 -2
- package/assets/{index-sWqCalkt.js → index-DPA1HCWQ.js} +233 -168
- package/assets/index-Dj91ulxd.js +646 -0
- package/assets/{index-hDlFWjNU.js → index-Dp4XCzCf.js} +1 -1
- package/assets/{index-D3Z0MZbL.js → index-iOuQJ8vu.js} +4 -4
- package/assets/{index-B872BsjL.js → index-usBlUHOb.js} +2 -2
- package/assets/knowledge.svg +4 -4
- package/assets/mysql.svg +14 -14
- package/assets/{plus-DDbDO7lA.js → plus-BICgMvz9.js} +1 -1
- package/assets/{search-BoBdGjgo.js → search-CD5YKija.js} +1 -1
- package/assets/sensitive.svg +5 -5
- package/assets/{style-DwfpZJI9.js → style-IJGVxGIy.js} +2 -2
- package/assets/style2.css +1 -1
- package/assets/style4.css +1 -1
- package/assets/{triangle-alert-DF53kXdm.js → triangle-alert-C4Z1AkGW.js} +1 -1
- package/assets/{x-DfdS1_QC.js → x-DWGzNb9c.js} +1 -1
- package/assistantConfig.js +28 -28
- package/chat.js +1 -1
- package/chatCompare.js +1 -1
- package/database.js +2 -2
- package/databaseId.d.ts +107 -2
- package/databaseId.js +1 -1
- package/databaseTable.js +2 -2
- package/index.d.ts +104 -0
- package/index.js +1 -1
- package/modelManage.js +1 -1
- package/package.json +6 -6
- package/sensitive.js +6 -6
- package/streamFilesReader.js +1 -1
- package/worker/pdf.worker.min.js +21 -21
- package/assets/index-BIrUv1JE.js +0 -576
- package/assets/index-Bk-pRt65.js +0 -27
- package/assets/index-CkVpaVb6.js +0 -1
- package/assets/index-SbYeytsI.js +0 -1
package/databaseId.d.ts
CHANGED
|
@@ -2,7 +2,102 @@ import { CustomComponents } from '@mxmweb/xviewer';
|
|
|
2
2
|
import { default as default_2 } from 'react';
|
|
3
3
|
import { Styles } from '@mxmweb/zui';
|
|
4
4
|
|
|
5
|
-
declare const
|
|
5
|
+
export declare const DatabaseIdI18nContext: default_2.Context<DatabaseIdI18nValue>;
|
|
6
|
+
|
|
7
|
+
export declare function DatabaseIdI18nProvider({ locale, messages: messagesOverride, children, }: {
|
|
8
|
+
locale: DatabaseIdLocale;
|
|
9
|
+
messages?: Partial<DatabaseIdMessages>;
|
|
10
|
+
children: default_2.ReactNode;
|
|
11
|
+
}): default_2.FunctionComponentElement<default_2.ProviderProps<DatabaseIdI18nValue>>;
|
|
12
|
+
|
|
13
|
+
declare interface DatabaseIdI18nValue {
|
|
14
|
+
locale: DatabaseIdLocale;
|
|
15
|
+
messages: DatabaseIdMessages;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 数据库(按 ID 管理)模块 i18n 文案
|
|
20
|
+
* 参考 login / modelManage:提供 zh / en / ja,多数文案集中在表格列、工具栏、抽屉标题与删除确认
|
|
21
|
+
*/
|
|
22
|
+
export declare type DatabaseIdLocale = 'zh' | 'en' | 'ja';
|
|
23
|
+
|
|
24
|
+
export declare interface DatabaseIdMessages {
|
|
25
|
+
views: {
|
|
26
|
+
directDB: {
|
|
27
|
+
label: string;
|
|
28
|
+
columns: {
|
|
29
|
+
name: string;
|
|
30
|
+
cnname: string;
|
|
31
|
+
colcount: string;
|
|
32
|
+
count: string;
|
|
33
|
+
actions: string;
|
|
34
|
+
};
|
|
35
|
+
toolbar: {
|
|
36
|
+
search: string;
|
|
37
|
+
config: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
dataTable: {
|
|
41
|
+
label: string;
|
|
42
|
+
columns: {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
descriptionHelp: string;
|
|
46
|
+
count: string;
|
|
47
|
+
status: string;
|
|
48
|
+
importStatus: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
actions: string;
|
|
52
|
+
};
|
|
53
|
+
toolbar: {
|
|
54
|
+
upload: string;
|
|
55
|
+
search: string;
|
|
56
|
+
config: string;
|
|
57
|
+
};
|
|
58
|
+
subTable: {
|
|
59
|
+
name: string;
|
|
60
|
+
count: string;
|
|
61
|
+
status: string;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
actions: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
actions: {
|
|
69
|
+
view: string;
|
|
70
|
+
editConfig: string;
|
|
71
|
+
appendData: string;
|
|
72
|
+
reImport: string;
|
|
73
|
+
delete: string;
|
|
74
|
+
deleteSub: string;
|
|
75
|
+
uploadDataFile: string;
|
|
76
|
+
};
|
|
77
|
+
drawer: {
|
|
78
|
+
uploadTitle: string;
|
|
79
|
+
appendTitle: string;
|
|
80
|
+
editConfigTitle: string;
|
|
81
|
+
};
|
|
82
|
+
confirm: {
|
|
83
|
+
deleteDatabaseTitle: string;
|
|
84
|
+
deleteDatabaseContent: string;
|
|
85
|
+
deleteDataTitle: string;
|
|
86
|
+
deleteDataContent: string;
|
|
87
|
+
okTextDelete: string;
|
|
88
|
+
cancelText: string;
|
|
89
|
+
};
|
|
90
|
+
message: {
|
|
91
|
+
deleteSuccess: string;
|
|
92
|
+
deleteFailed: string;
|
|
93
|
+
deleteDataFailed: string;
|
|
94
|
+
deleteAppendSuccess: string;
|
|
95
|
+
editConfigSuccess: string;
|
|
96
|
+
editConfigFailed: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare const DatabaseViewAdopter: default_2.ForwardRefExoticComponent<DatabaseViewAdopterProps & default_2.RefAttributes<DatabaseViewAdopterRef>>;
|
|
6
101
|
export default DatabaseViewAdopter;
|
|
7
102
|
|
|
8
103
|
declare interface DatabaseViewAdopterProps {
|
|
@@ -16,9 +111,17 @@ declare interface DatabaseViewAdopterProps {
|
|
|
16
111
|
CustomComponents?: CustomComponents;
|
|
17
112
|
eventsEmit?: (name: string, data: any) => void;
|
|
18
113
|
getBtnDisabled?: (type: OPT_BTN, permission: number) => boolean;
|
|
19
|
-
|
|
114
|
+
locale?: DatabaseIdLocale;
|
|
115
|
+
messages?: Partial<DatabaseIdMessages>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** 通过 ref 暴露给父组件的方法 */
|
|
119
|
+
export declare interface DatabaseViewAdopterRef {
|
|
120
|
+
getDatabaseDetail: () => Promise<void>;
|
|
20
121
|
}
|
|
21
122
|
|
|
123
|
+
export declare function getDatabaseIdMessages(locale: DatabaseIdLocale, override?: Partial<DatabaseIdMessages>): DatabaseIdMessages;
|
|
124
|
+
|
|
22
125
|
declare enum OPT_BTN {
|
|
23
126
|
DATE = 0,
|
|
24
127
|
VIEW = 1,
|
|
@@ -33,6 +136,8 @@ declare enum OPT_BTN {
|
|
|
33
136
|
AUTHORIZE_CONFIG = 10
|
|
34
137
|
}
|
|
35
138
|
|
|
139
|
+
export declare function useDatabaseIdI18n(): DatabaseIdI18nValue;
|
|
140
|
+
|
|
36
141
|
export { }
|
|
37
142
|
|
|
38
143
|
|
package/databaseId.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as u,jsxs as k,Fragment as ge}from"react/jsx-runtime";import{useMemo as P,useState as E,useRef as pe,useCallback as O,useEffect as Ae,forwardRef as ze,useImperativeHandle as Le}from"react";import{u as _e}from"./assets/index-CpW6Dhpp.js";import{F as Ve,J as W,C as Ne,T as Re,U as Ue,$ as He}from"./assets/index-sWqCalkt.js";import{A as Ge,T as me,a7 as $e,i as he}from"./assets/index-BvpN2hYX.js";import{O as xe}from"./assets/index-BIrUv1JE.js";/* empty css *//* empty css */import{N as we}from"./assets/index-hDlFWjNU.js";import{s as $,M as Ee}from"./assets/index-D3Z0MZbL.js";import{D as ve}from"./assets/index-CkVpaVb6.js";import{X as fe}from"./assets/x-DfdS1_QC.js";import{P as We,L as Ze}from"./assets/index-B872BsjL.js";import{B as ye}from"./assets/index-BxR_BLxA.js";import{T as ke}from"./assets/triangle-alert-DF53kXdm.js";import"react-dom";import"./assets/index-DaM9Fbys.js";import"./assets/LeftOutlined-9XTSYGbi.js";import"./assets/index-Bk-pRt65.js";import"./assets/index-SbYeytsI.js";const qe="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='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",Ie=({url:s,token:A,role:d,eventsEmit:F})=>{const p=Ge.create({baseURL:s,timeout:1e6});return p.interceptors.request.use(a=>{let t=A;return!t&&!["user/login","user/kaptcha","user/regist"].some(i=>a.url.includes(i))?(F&&F("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(a.headers.Authorization=t||"",a.headers.userName=d==="\u672A\u767B\u5F55\u7528\u6237"?"":d,a)}),p.interceptors.response.use(a=>{const t=["user/kaptcha"],r=a.data;if(t.some(z=>a.config.url&&a.config.url.includes(z))||r.size&&r.type)return r;const{success:i,errorMsg:h,errorCode:b}=r;if(i)return r;F&&F("request:error_business",{errorCode:b,errorMsg:h||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r})},a=>{var t,r,i,h,b,z,o,N,X;if(a.message==="canceled")return Promise.reject(a);if(F){let q="request:error_network",j={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:a};((t=a==null?void 0:a.response)==null?void 0:t.status)===401?(q="request:error_auth",j={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:a,redirect:"/login"}):(((i=(r=a==null?void 0:a.response)==null?void 0:r.data)==null?void 0:i.errorCode)==="30013"||((b=(h=a==null?void 0:a.response)==null?void 0:h.data)==null?void 0:b.errorCode)==="30023")&&(q="request:error_business",j={errorCode:(o=(z=a==null?void 0:a.response)==null?void 0:z.data)==null?void 0:o.errorCode,errorMsg:((X=(N=a==null?void 0:a.response)==null?void 0:N.data)==null?void 0:X.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:a}),F(q,j)}return Promise.reject(a)}),{getTableList:async a=>{try{const t=await p.get(`/directDB/queryTableList/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("getTableList error:",t)}},getTableTreeList:async a=>{try{const t=await p.get(`/dataTable/queryTableFileTreeList/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("getTableTreeList error:",t)}},getDBDetailById:async(a,t)=>{const r=De(t);try{const i=await p.get(`/${r}/queryDBInfo/${a}`),{success:h,data:b}=i;if(h)return b}catch(i){console.log("getDBDetailById error:",i)}},delTableById:async(a,t)=>{const r=De(t);try{const i=await p.delete(`/${r}/deleteTable/${a}`),{success:h,data:b}=i;if(h)return b}catch(i){console.log("delTableById error:",i)}},delFileById:async a=>{try{const t=await p.delete(`/dataTable/deleteTableFileData/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("delFileById",t)}},parseFiles:async({fileIds:a,isGenDescription:t,tableDescriptionMap:r})=>{try{const i=await p.post("/dataTable/parseFiles",{fileIds:a,isGenDescription:t,tableDescriptionMap:r}),{success:h,data:b}=i;if(h)return b}catch(i){console.log("parseFiles error:",i)}},reParseFile:async a=>{try{const t=await p.post(`/dataTable/reParseFile/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("reParseFile error:",t)}},parseAppendFile:async({fileIds:a,tableId:t})=>{try{const r=await p.post("/dataTable/parseAppendFiles",{fileIds:a,tableId:t}),{success:i,data:h}=r;if(i)return h}catch(r){console.log("parseAppendFile error:",r)}},deleteUploadedFiles:async a=>{try{const t=await p.post("/dataTable/cancelUploadFile",{fileIds:a}),{success:r,data:i}=t;if(r)return i}catch(t){console.log("deleteUploadedFiles error:",t)}},getTableInfoById:async a=>{try{const t=await p.get(`/dataTable/queryTableMeta/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("getTableInfoById error:",t)}},updateTableInfo:async({tableId:a,description:t,businessName:r})=>{try{const i=await p.post("/dataTable/updateTableInfo",{tableId:a,businessName:r,description:t}),{success:h,data:b}=i;if(h)return b}catch(i){console.log("updateTableInfo error:",i)}},optimizeDesc:async a=>{try{const t=await p.get(`/genTableDescription/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("optimizeDesc error:",t)}}}},De=s=>s=="DataTable"?"dataTable":"directDB",ce='<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',Oe={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},Ye=({drawerTitle:s,drawerVisible:A,uploadUrl:d,handleDrawerClose:F,dbId:p,tableInfo:m,token:S,url:K,role:f})=>{const M=P(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!m,accept:".csv,.xlsx,.xls",maxFiles:m?1:20,url:d,autoUpload:!0,headers:{Authorization:S},queryParams:{databaseId:p,...m&&{tableId:m.tableId}},placeholder:k("div",{children:[u("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),k("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[u("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),u("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"}),u("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"}),u("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:m?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:u("img",{src:je,width:40}),itemStatus:{pending:u("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:u("span",{style:{fontSize:"12px",color:"#007bff"}}),success:u("span",{style:{fontSize:"12px",color:"#10b981"}}),error:u("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:u(Ve,{size:20,style:{color:"#6b7280"}})}},...!m&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:u("img",{src:qe}),mode:"text",onClick:()=>{i(!0)}}]},...!m&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[m]),[Y,V]=E(!1),[g,C]=E({}),U=pe(null),[Z,H]=E(!1),[a,t]=E([]),[r,i]=E(!1),[h,b]=E(ce),[z,o]=E(null),[N,X]=E(ce),[q,j]=E(0),{parseFiles:ae,parseAppendFile:se,deleteUploadedFiles:ie}=Ie({url:K,token:S,role:f}),J=O(async(c,n,I)=>{var x;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",c,n),c){case"form:ready":n.formRef?U.current=n.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":Q();break;case"form_field_change":C(T=>({...T,[n.fieldId]:n.value}));break;case"uploader:error":(x=n.item)!=null&&x.id?t(T=>[{id:n.item.id,status:n.item.status},...T]):$.error(n==null?void 0:n.message);break;case"uploader:success":t(T=>[{id:n.item.id,status:n.item.status},...T]);break;case"uploader:remove":const _=n.item.status;t(T=>T.filter(R=>R.id!==n.item.id)),_=="success"&&await ue([n.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",c)}},[]),re=P(()=>({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:M.formWidth,formConfig:{layout:M.layout,showReset:!1,showSubmit:!1,formWidth:M.formWidth,getFormData:()=>({...g,timestamp:new Date().toISOString(),formId:M.id}),onFieldChange:(c,n)=>{J("form_field_change",{fieldId:c,value:n},void 0)},onValidationError:c=>{J("form_validation_error",c,void 0)}}}],dataSource:[{id:M.id,fields:M.fields,defaultValues:{}}],eventsEmit:J,styles:{theme:Oe}}),[m,M]),Q=async()=>{var c;try{V(!0);const n=await U.current.getAllData();if(n.isValid){const I=(c=n.fields.find(x=>x.name=="fileIds"))==null?void 0:c.value;if(Array.isArray(I)&&(I==null?void 0:I.length)>0){let x;if(m)x=await se({fileIds:I.map(_=>_.uploadApiRes),tableId:m.id});else{const _={fileIds:I.map(T=>T.uploadApiRes),tableDescriptionMap:I.reduce((T,R)=>(T[R.uploadApiRes]=R.formData.description,T),{}),isGenDescription:Z};x=await ae(_)}x&&F("refresh")}}}catch(n){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",n)}finally{F(),V(!1),H(!1)}},ee=async c=>{var n;try{const I=await U.current.getAllData();if(I.isValid){const x=(n=I.fields.find(_=>_.name=="fileIds"))==null?void 0:n.value;if(x&&Array.isArray(x)&&(x==null?void 0:x.length)>0){const _=x.map(R=>R.uploadApiRes),T=await ue(_)}}}catch(I){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",I)}finally{F(),H(!1)}},ue=async c=>{try{const n=await ie(c);if(n)return n}catch(n){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",n)}},oe=c=>{H(c)},te=O(c=>{b(c),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",c)},[]),le=O(c=>{o(()=>c),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),ne=O(async()=>{try{if(!z){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const c=z("pure_string");await navigator.clipboard.writeText(c),$.success("\u5DF2\u590D\u5236",1)}catch(c){console.error("\u590D\u5236\u5931\u8D25:",c)}finally{i(!1)}},[z]);return k(ve,{title:s,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:u(fe,{size:20,color:"#888888",onClick:()=>ee(),className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:k("div",{className:"flex items-center",style:{justifyContent:m?"end":"space-between"},children:[!m&&k("div",{className:"flex gap-2 items-center",children:[u("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",u(me,{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:u(Ne,{size:14})}),u($e,{onChange:oe})]}),k("div",{className:"flex self-end gap-3",children:[u(W,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:ee}),u(W,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:Y,disabled:a.some(c=>c.status=="error"),onClick:async()=>{await Q()}})]})]}),children:[u(xe,{...re},"upload-file"),u(Ee,{title:k("div",{children:["\u6A21\u7248",u("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:r,onCancel:()=>i(!1),footer:k("div",{className:"flex justify-end items-center gap-3",children:[u(W,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{X(ce),j(c=>c+1)}}),u(W,{mode:"primary",label:"\u590D\u5236",onClick:ne})]}),children:u(we,{data:N,onChange:te,onGetData:le,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"}}},q)})]})},Xe="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",Ke="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:Je}=Ee,Pe='<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',Qe=({drawerTitle:s,drawerVisible:A,tableInfo:d,handleDrawerClose:F,optimizeDesc:p,eventsEmit:m})=>{const S=P(()=>(d==null?void 0:d.data.find(o=>o.columnId=="name").value)||"-",[d]),[K,f]=E(""),[M,Y]=E(null),[V,g]=E(""),[C,U]=E(0),[Z,H]=E(!1),[a,t]=E(!1);Ae(()=>{const o=(d==null?void 0:d.data.find(N=>N.columnId=="description").value)||"-";g(o)},[d]);const r=()=>{Je({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(){g(Pe),U(o=>o+1)},onCancel(){console.log("Cancel")}})},i=O(o=>{f(o),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",o)},[]),h=O(o=>{Y(()=>o),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),b=async()=>{try{H(!0);const o=await p(d.tableId);o&&(g(o),U(N=>N+1),H(!1))}catch{$.error("AI \u4F18\u5316\u5931\u8D25")}},z=O(()=>{if(!M){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const o=M("pure_string");m("table_info:update",o)},[M,m]);return k(ve,{title:s,placement:"right",width:720,onClose:F,closeIcon:!1,extra:u(fe,{size:20,color:"#888888",onClick:F,className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:u("div",{className:"flex items-center",style:{justifyContent:"end"},children:k("div",{className:"flex self-end gap-3",children:[u(W,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:F}),u(W,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>z(),disabled:Z})]})}),children:[u("div",{className:"mb-[10px] font-bold",children:S}),k("div",{className:"mb-[10px]",children:[u("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),u("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),u("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)"})]}),u(we,{data:V,onChange:i,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"}}},C),k("div",{children:[u(We,{open:a,onOpenChange:o=>t(!!o),content:u("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:r,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:k("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[u("div",{className:"text-[16px]",children:"\u6A21\u7248"}),u(fe,{size:20,color:"#888888",onClick:()=>t(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:o=>o,children:u("span",{children:u(W,{mode:"text",icon:u("img",{src:Xe}),children:"\u4F7F\u7528\u6A21\u7248"})})}),u(W,{onClick:b,mode:"text",icon:u("img",{src:Ke}),loading:Z,children:"AI\u4F18\u5316"})]})]})},eu=""+new URL("assets/empty.png",import.meta.url).href;var G=(s=>(s[s.DATE=0]="DATE",s[s.VIEW=1]="VIEW",s[s.ERROR=2]="ERROR",s[s.AUTHORIZE=3]="AUTHORIZE",s[s.DELETE=4]="DELETE",s[s.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",s[s.DOWNLOAD=6]="DOWNLOAD",s[s.EDIT=7]="EDIT",s[s.ADD=8]="ADD",s[s.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",s[s.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",s))(G||{}),Ce=(s=>(s.GENERATING="generating",s.SUCCESS="success",s.FAIL="fail",s))(Ce||{});const de={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},uu=s=>typeof s=="string"&&s in de?de[s]:de.default,Fe=s=>{const{value:A,cell:d}=s;switch(d.columnId){case"importstatus":return A?u(me,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:u(Re,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):u(ge,{});case"status":const F=uu(s.cell.statusType);return A=="\u5BFC\u5165\u5931\u8D25"?u(me,{title:d.errorMsg,children:k("div",{className:"flex items-center gap-2",children:[u(ye,{color:F,text:A}),u(ke,{size:14,color:"red"})]})}):u(ye,{color:F,text:A});default:return u(ge,{})}},be=[{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"}],tu=s=>{var F,p;const{cell:A,value:d}=s;return typeof d=="string"?u("div",{title:d,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d}):(F=A.tableMeta)!=null&&F.isGenDescription&&((p=A.tableMeta)==null?void 0:p.generateDescriptionStatus)=="generating"?k("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[u("span",{children:"\u751F\u6210\u4E2D"}),u(Ze,{size:14})]}):"-"},au=({dbInfo:s,setDrawerTitle:A,setDrawerVisible:d,getBtnDisabled:F})=>k("div",{className:"flex flex-col items-center justify-center h-full",children:[u("div",{className:"text-xl font-semibold mb-3",children:u("img",{src:eu,width:120})}),u("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),u("div",{className:"flex gap-3",children:u(W,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:F&&F(8,s==null?void 0:s.permission),onClick:()=>{A("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),d(!0)}})})]}),{confirm:Be}=Ee,Au=ze((s,A)=>{const{url:d,token:F,role:p,id:m,dbType:S,CustomComponents:K,getBtnDisabled:f,uploadUrl:M}=s,[Y,V]=E({container:"ready",content:"ready"}),g=pe(null),C=pe(null),[U,Z]=E(),[H,a]=E({}),[t,r]=E(),[i,h]=E(!1),[b,z]=E(""),[o,N]=E(),[X,q]=E(!1),[j,ae]=E(""),{getTableList:se,delTableById:ie,delFileById:J,updateTableInfo:re,optimizeDesc:Q,getTableTreeList:ee,reParseFile:ue,getDBDetailById:oe}=Ie({url:d,token:F,role:p,eventsEmit:s.eventsEmit});Ae(()=>(m&&S&&(V(l=>({...l,container:"loading"})),te()),()=>{C.current&&(clearTimeout(C.current),C.current=null)}),[m,S]);const te=async()=>{try{const l=await oe(m,S);l&&(r(l),V(e=>({...e,container:"ready",content:"loading"})))}catch(l){console.log("[TableApiError] getDBInfo:",l)}await R()};Le(A,()=>({getDatabaseDetail:te}));const le=async()=>{try{if(S=="DirectDB"){const l=await se(m);if(l){const e=c(l);return Z(e||[]),V(L=>({...L,content:"ready"})),e||[]}else V(e=>({...e,content:"error"}))}else{const l=await ee(m);if(l){const e=ne(l);return Z(e||[]),V(L=>({...L,content:"ready"})),e||[]}else V(e=>({...e,content:"error"}))}}catch(l){console.log("[TableApiError] getTableList:",l)}};function ne(l){return(l||[]).map((e,L)=>{var D,v;let y=be.find(B=>B.status==e.status);const w=e.children.some(B=>B.status=="00");return{id:e.fileId.toString(),tableId:e.tableId,data:[{columnId:"name",value:(e==null?void 0:e.originalFilename)||"-",type:"label"},{columnId:"description",value:(D=e==null?void 0:e.tableMeta)==null?void 0:D.description,type:"customized",tableMeta:e==null?void 0:e.tableMeta},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`,type:"text"},{columnId:"status",...y,type:"customized",errorMsg:e.errorMsg},{columnId:"importstatus",value:w,type:"customized"},{columnId:"createdAt",value:e.gmtCreate,type:"date"},{columnId:"updatedAt",value:e.gmtModified,type:"date"},...e.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:f&&f(G.VIEW,e.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:f&&f(G.EDIT,e.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:f&&f(G.EDIT,e.permission)}]:[],...e.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action"}]:[],{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",disabled:f&&f(G.DELETE,e.permission)}],expanded:!1,...e.children&&((v=e.children)==null?void 0:v.length)>0&&{children:[...(e.children||[]).map(B=>{const Te=be.find(Me=>Me.status==B.status),Se=[{columnId:"name",value:B.originalFilename,type:"text"},{columnId:"count",value:`${B.rowCount}\u884C\uFF0C${B.columnCount}\u5217`,type:"text"},{columnId:"status",...Te,errorMsg:B.errorMsg,type:"customized"},{columnId:"createdAt",value:B.gmtCreate,type:"date"},{columnId:"updatedAt",value:B.gmtModified,type:"date"},...B.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:f&&f(G.VIEW,B.permission)}]:[],...B.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:f&&f(G.ADD,B.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:f&&f(G.DELETE,B.permission)}];return{id:B.fileId.toString(),tableId:B.tableId,data:Se}})]}}})}function c(l){return(l||[]).map((e,L)=>({id:e.id||_e(8),data:[{columnId:"name",value:e.physicalName},{columnId:"cnname",value:e.businessName},{columnId:"colcount",value:e.columnCount},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`},{columnId:"actions",value:"view",label:"\u67E5\u770B",disabled:f&&f(G.VIEW,e.permission)}]}))}async function n(l,e,L){switch(console.log("[adopter] mergedEventsEmit",l,e,L),l){case"table_action_delete":{try{if(console.log("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E:",e),!e||!e.tableId&&!e.id){console.error("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E\u4E0D\u5B8C\u6574:",e),$.error("\u5220\u9664\u5931\u8D25\uFF1A\u6570\u636E\u4E0D\u5B8C\u6574");return}const y=e.tableId||e.id,w=e.id;Be({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:u(ke,{color:"#FF4D4F",className:"mr-[8px]"}),okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await ie(y,S)&&(g!=null&&g.current)?(g==null||g.current.appFn.removeItem(w),$.success("\u5220\u9664\u6210\u529F")):$.error("\u5220\u9664\u5931\u8D25")}})}catch(y){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25:",y),$.error("\u5220\u9664\u5931\u8D25")}break}case"table_action_edit":{ae("\u4FEE\u6539\u6570\u636E\u914D\u7F6E"),q(!0),N(e);break}case"toolbar_upload":{z("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),h(!0);break}case"table_action_addData":{z("\u8FFD\u52A0\u6570\u636E"),h(!0),N(e);break}case"table_action_reValidate":{await ue(e.id)&&(C.current&&(clearTimeout(C.current),C.current=null),await R());break}case"table_info:update":{try{if(o!=null&&o.id){const y=(o==null?void 0:o.data.find(D=>D.columnId=="name").value)||"-";if(await re({tableId:o.tableId,description:e,businessName:y})&&(g!=null&&g.current)){const D={...o,data:o.data.map(v=>v.columnId=="description"?{...v,value:e}:v)};g==null||g.current.appFn.updateItem(D,o.id),$.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(y){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",y)}finally{_()}break}case"table_action_delete_sub":{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(){const{id:y,tableId:w}=e;await J(e.id)&&(g!=null&&g.current)&&(a(v=>({...v,[w]:[...v[w]||[],y]})),e.data.find(v=>v.status=="00")&&(C.current&&(clearTimeout(C.current),C.current=null),R()),L.removeItem(y,w),$.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 s.eventsEmit=="function"&&s.eventsEmit("toolbar_auth",t);break}default:typeof s.eventsEmit=="function"&&s.eventsEmit(l,e);break}}const I=P(()=>({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,S]),x=P(()=>({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:u(tu,{}),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:u(Fe,{})},{id:"importstatus",title:"\u8FFD\u52A0\u63D0\u793A",type:"customized",component:u(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:f&&f(G.ADD,t==null?void 0:t.permission),icon:u(Ue,{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:u(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:H,onSubTableRowAnimationComplete:(l,e)=>{a(L=>({...L,[l]:(L[l]||[]).filter(y=>y!==e)}))}}),[H,U,S,t]),_=l=>{h(!1),q(!1),N(void 0),l=="refresh"&&(C.current&&(clearTimeout(C.current),C.current=null),R())};function T(l){var e,L;if(!Array.isArray(l))return!0;for(const y of l){if(y.data){const w=y.data.find(v=>v.columnId==="status"),D=y.data.find(v=>v.columnId==="description");if(console.log("+++++",w.status==="20"||w.status==="11"||((e=D==null?void 0:D.tableMeta)==null?void 0:e.generateDescriptionStatus)==Ce.GENERATING),w&&(w.status==="20"||w.status==="11"||((L=D==null?void 0:D.tableMeta)==null?void 0:L.generateDescriptionStatus)==Ce.GENERATING))return!1}if(Array.isArray(y.children)){for(const w of y.children)if(w.data){const D=w.data.find(v=>v.columnId==="status");if(D&&(D.status==="20"||D.status==="11"))return!1}}}return!0}const R=async()=>{const l=await le();T(l||[])?C.current&&(clearTimeout(C.current),C.current=null):(C.current&&(clearTimeout(C.current),C.current=null),C.current=setTimeout(()=>{R()},5e3))};return k(He,{title:t==null?void 0:t.name,description:(t==null?void 0:t.description)||"-",goBack:()=>{var l;(l=s.eventsEmit)==null||l.call(s,"goBack",{})},children:[u(xe,{dataSource:U,ref:g,eventsEmit:n,status:Y,styles:{theme:{...he,colors:{...he.colors,tableFirstColumnBg:"#ffffff",tableLastColumnBg:"#ffffff",paginationBackground:"#ffffff",subTableBackground:"#F5F5F5",tableHeaderBg:"#F5F5F5"}},mode:"light"},CustomComponents:{EmptyData:()=>u(au,{dbInfo:t,setDrawerTitle:z,setDrawerVisible:h,getBtnDisabled:f}),...K},...S=="DataTable"?x:I}),u(Ye,{drawerTitle:b,drawerVisible:i,handleDrawerClose:_,dbId:m,token:F,url:d,uploadUrl:M,role:p,tableInfo:o}),u(Qe,{drawerTitle:j,drawerVisible:X,handleDrawerClose:_,tableInfo:o,optimizeDesc:Q,eventsEmit:n})]})});export{Au as default};
|
|
1
|
+
import{jsx as u,jsxs as S,Fragment as Ae}from"react/jsx-runtime";import se,{useMemo as Q,useState as b,useRef as Ce,useCallback as P,useEffect as Te,forwardRef as xe,useImperativeHandle as Re}from"react";import{u as Ue}from"./assets/index-CpW6Dhpp.js";import{F as He,Y as $,C as Ge,T as We,U as $e,N as Ze}from"./assets/index-DPA1HCWQ.js";import{w as qe,T as fe,a4 as je,f as Be}from"./assets/index-DHK_n74G.js";import{z as Ie}from"./assets/index-Dj91ulxd.js";/* empty css *//* empty css */import{N as ke}from"./assets/index-Dp4XCzCf.js";import{s as G,M as be}from"./assets/index-iOuQJ8vu.js";import{D as Se}from"./assets/index-CzZQWA2P.js";import{X as De}from"./assets/x-DWGzNb9c.js";import{P as Ye,L as Oe}from"./assets/index-usBlUHOb.js";import{B as he}from"./assets/index-97Oe7YBe.js";import{T as Me}from"./assets/triangle-alert-C4Z1AkGW.js";import"react-dom";import"./assets/index-B4k3tK0f.js";import"./assets/LeftOutlined-DZMeGbKk.js";import"./assets/index-BIEKgWu0.js";const Pe="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",Xe="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:t,token:D,role:r,eventsEmit:d})=>{const C=qe.create({baseURL:t,timeout:1e6});return C.interceptors.request.use(a=>{let i=D;return!i&&!["user/login","user/kaptcha","user/regist"].some(n=>a.url.includes(n))?(d&&d("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(a.headers.Authorization=i||"",a.headers.userName=r==="\u672A\u767B\u5F55\u7528\u6237"?"":r,a)}),C.interceptors.response.use(a=>{const i=["user/kaptcha"],l=a.data;if(i.some(N=>a.config.url&&a.config.url.includes(N))||l.size&&l.type)return l;const{success:n,errorMsg:y,errorCode:B}=l;if(n)return l;d&&d("request:error_business",{errorCode:B,errorMsg:y||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:l})},a=>{var i,l,n,y,B,N,p,h,Z;if(a.message==="canceled")return Promise.reject(a);if(d){let O="request:error_network",q={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:a};((i=a==null?void 0:a.response)==null?void 0:i.status)===401?(O="request:error_auth",q={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:a,redirect:"/login"}):(((n=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:n.errorCode)==="30013"||((B=(y=a==null?void 0:a.response)==null?void 0:y.data)==null?void 0:B.errorCode)==="30023")&&(O="request:error_business",q={errorCode:(p=(N=a==null?void 0:a.response)==null?void 0:N.data)==null?void 0:p.errorCode,errorMsg:((Z=(h=a==null?void 0:a.response)==null?void 0:h.data)==null?void 0:Z.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:a}),d(O,q)}return Promise.reject(a)}),{getTableList:async a=>{try{const i=await C.get(`/directDB/queryTableList/${a}`),{success:l,data:n}=i;if(l)return n}catch(i){console.log("getTableList error:",i)}},getTableTreeList:async a=>{try{const i=await C.get(`/dataTable/queryTableFileTreeList/${a}`),{success:l,data:n}=i;if(l)return n}catch(i){console.log("getTableTreeList error:",i)}},getDBDetailById:async(a,i)=>{const l=ye(i);try{const n=await C.get(`/${l}/queryDBInfo/${a}`),{success:y,data:B}=n;if(y)return B}catch(n){console.log("getDBDetailById error:",n)}},delTableById:async(a,i)=>{const l=ye(i);try{const n=await C.delete(`/${l}/deleteTable/${a}`),{success:y,data:B}=n;if(y)return B}catch(n){console.log("delTableById error:",n)}},delFileById:async a=>{try{const i=await C.delete(`/dataTable/deleteTableFileData/${a}`),{success:l,data:n}=i;if(l)return n}catch(i){console.log("delFileById",i)}},parseFiles:async({fileIds:a,isGenDescription:i,tableDescriptionMap:l})=>{try{const n=await C.post("/dataTable/parseFiles",{fileIds:a,isGenDescription:i,tableDescriptionMap:l}),{success:y,data:B}=n;if(y)return B}catch(n){console.log("parseFiles error:",n)}},reParseFile:async a=>{try{const i=await C.post(`/dataTable/reParseFile/${a}`),{success:l,data:n}=i;if(l)return n}catch(i){console.log("reParseFile error:",i)}},parseAppendFile:async({fileIds:a,tableId:i})=>{try{const l=await C.post("/dataTable/parseAppendFiles",{fileIds:a,tableId:i}),{success:n,data:y}=l;if(n)return y}catch(l){console.log("parseAppendFile error:",l)}},deleteUploadedFiles:async a=>{try{const i=await C.post("/dataTable/cancelUploadFile",{fileIds:a}),{success:l,data:n}=i;if(l)return n}catch(i){console.log("deleteUploadedFiles error:",i)}},getTableInfoById:async a=>{try{const i=await C.get(`/dataTable/queryTableMeta/${a}`),{success:l,data:n}=i;if(l)return n}catch(i){console.log("getTableInfoById error:",i)}},updateTableInfo:async({tableId:a,description:i,businessName:l})=>{try{const n=await C.post("/dataTable/updateTableInfo",{tableId:a,businessName:l,description:i}),{success:y,data:B}=n;if(y)return B}catch(n){console.log("updateTableInfo error:",n)}},optimizeDesc:async a=>{try{const i=await C.get(`/genTableDescription/${a}`),{success:l,data:n}=i;if(l)return n}catch(i){console.log("optimizeDesc error:",i)}}}},ye=t=>t=="DataTable"?"dataTable":"directDB",Fe='<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',Ke={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},Je=({drawerTitle:t,drawerVisible:D,uploadUrl:r,handleDrawerClose:d,dbId:C,tableInfo:f,token:z,url:X,role:E})=>{const L=Q(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!f,accept:".csv,.xlsx,.xls",maxFiles:f?1:20,url:r,autoUpload:!0,headers:{Authorization:z},queryParams:{databaseId:C,...f&&{tableId:f.tableId}},placeholder:S("div",{children:[u("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),S("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[u("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),u("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"}),u("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"}),u("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:f?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:u("img",{src:Xe,width:40}),itemStatus:{pending:u("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:u("span",{style:{fontSize:"12px",color:"#007bff"}}),success:u("span",{style:{fontSize:"12px",color:"#10b981"}}),error:u("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:u(He,{size:20,style:{color:"#6b7280"}})}},...!f&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:u("img",{src:Pe}),mode:"text",onClick:()=>{n(!0)}}]},...!f&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[f]),[s,Y]=b(!1),[_,A]=b({}),m=Ce(null),[W,U]=b(!1),[a,i]=b([]),[l,n]=b(!1),[y,B]=b(Fe),[N,p]=b(null),[h,Z]=b(Fe),[O,q]=b(0),{parseFiles:ie,parseAppendFile:le,deleteUploadedFiles:ne}=ze({url:X,token:z,role:E}),K=P(async(F,c,M)=>{var T;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",F,c),F){case"form:ready":c.formRef?m.current=c.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":ee();break;case"form_field_change":A(x=>({...x,[c.fieldId]:c.value}));break;case"uploader:error":(T=c.item)!=null&&T.id?i(x=>[{id:c.item.id,status:c.item.status},...x]):G.error(c==null?void 0:c.message);break;case"uploader:success":i(x=>[{id:c.item.id,status:c.item.status},...x]);break;case"uploader:remove":const R=c.item.status;i(x=>x.filter(j=>j.id!==c.item.id)),R=="success"&&await te([c.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",F)}},[]),oe=Q(()=>({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:L.formWidth,formConfig:{layout:L.layout,showReset:!1,showSubmit:!1,formWidth:L.formWidth,getFormData:()=>({..._,timestamp:new Date().toISOString(),formId:L.id}),onFieldChange:(F,c)=>{K("form_field_change",{fieldId:F,value:c},void 0)},onValidationError:F=>{K("form_validation_error",F,void 0)}}}],dataSource:[{id:L.id,fields:L.fields,defaultValues:{}}],eventsEmit:K,styles:{theme:Ke}}),[f,L]),ee=async()=>{var F;try{Y(!0);const c=await m.current.getAllData();if(c.isValid){const M=(F=c.fields.find(T=>T.name=="fileIds"))==null?void 0:F.value;if(Array.isArray(M)&&(M==null?void 0:M.length)>0){let T;if(f)T=await le({fileIds:M.map(R=>R.uploadApiRes),tableId:f.id});else{const R={fileIds:M.map(x=>x.uploadApiRes),tableDescriptionMap:M.reduce((x,j)=>(x[j.uploadApiRes]=j.formData.description,x),{}),isGenDescription:W};T=await ie(R)}T&&d("refresh")}}}catch(c){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",c)}finally{d(),Y(!1),U(!1)}},ue=async F=>{var c;try{const M=await m.current.getAllData();if(M.isValid){const T=(c=M.fields.find(R=>R.name=="fileIds"))==null?void 0:c.value;if(T&&Array.isArray(T)&&(T==null?void 0:T.length)>0){const R=T.map(j=>j.uploadApiRes),x=await te(R)}}}catch(M){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",M)}finally{d(),U(!1)}},te=async F=>{try{const c=await ne(F);if(c)return c}catch(c){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",c)}},re=F=>{U(F)},ce=P(F=>{B(F),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",F)},[]),ae=P(F=>{p(()=>F),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),de=P(async()=>{try{if(!N){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const F=N("pure_string");await navigator.clipboard.writeText(F),G.success("\u5DF2\u590D\u5236",1)}catch(F){console.error("\u590D\u5236\u5931\u8D25:",F)}finally{n(!1)}},[N]);return S(Se,{title:t,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:u(De,{size:20,color:"#888888",onClick:()=>ue(),className:"cursor-pointer"}),open:D,destroyOnHidden:!0,footer:S("div",{className:"flex items-center",style:{justifyContent:f?"end":"space-between"},children:[!f&&S("div",{className:"flex gap-2 items-center",children:[u("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",u(fe,{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:u(Ge,{size:14})}),u(je,{onChange:re})]}),S("div",{className:"flex self-end gap-3",children:[u($,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:ue}),u($,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:s,disabled:a.some(F=>F.status=="error"),onClick:async()=>{await ee()}})]})]}),children:[u(Ie,{...oe},"upload-file"),u(be,{title:S("div",{children:["\u6A21\u7248",u("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:l,onCancel:()=>n(!1),footer:S("div",{className:"flex justify-end items-center gap-3",children:[u($,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{Z(Fe),q(F=>F+1)}}),u($,{mode:"primary",label:"\u590D\u5236",onClick:de})]}),children:u(ke,{data:h,onChange:ce,onGetData:ae,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"}}},O)})]})},Qe="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",eu="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:uu}=be,tu='<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',au=({drawerTitle:t,drawerVisible:D,tableInfo:r,handleDrawerClose:d,optimizeDesc:C,eventsEmit:f})=>{const z=Q(()=>(r==null?void 0:r.data.find(p=>p.columnId=="name").value)||"-",[r]),[X,E]=b(""),[L,s]=b(null),[Y,_]=b(""),[A,m]=b(0),[W,U]=b(!1),[a,i]=b(!1);Te(()=>{const p=(r==null?void 0:r.data.find(h=>h.columnId=="description").value)||"-";_(p)},[r]);const l=()=>{uu({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(){_(tu),m(p=>p+1)},onCancel(){console.log("Cancel")}})},n=P(p=>{E(p),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",p)},[]),y=P(p=>{s(()=>p),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),B=async()=>{try{U(!0);const p=await C(r.tableId);p&&(_(p),m(h=>h+1),U(!1))}catch{G.error("AI \u4F18\u5316\u5931\u8D25")}},N=P(()=>{if(!L){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const p=L("pure_string");f("table_info:update",p)},[L,f]);return S(Se,{title:t,placement:"right",width:720,onClose:d,closeIcon:!1,extra:u(De,{size:20,color:"#888888",onClick:d,className:"cursor-pointer"}),open:D,destroyOnHidden:!0,footer:u("div",{className:"flex items-center",style:{justifyContent:"end"},children:S("div",{className:"flex self-end gap-3",children:[u($,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:d}),u($,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>N(),disabled:W})]})}),children:[u("div",{className:"mb-[10px] font-bold",children:z}),S("div",{className:"mb-[10px]",children:[u("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),u("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),u("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)"})]}),u(ke,{data:Y,onChange:n,onGetData:y,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"}}},A),S("div",{children:[u(Ye,{open:a,onOpenChange:p=>i(!!p),content:u("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:l,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:S("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[u("div",{className:"text-[16px]",children:"\u6A21\u7248"}),u(De,{size:20,color:"#888888",onClick:()=>i(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:p=>p,children:u("span",{children:u($,{mode:"text",icon:u("img",{src:Qe}),children:"\u4F7F\u7528\u6A21\u7248"})})}),u($,{onClick:B,mode:"text",icon:u("img",{src:eu}),loading:W,children:"AI\u4F18\u5316"})]})]})},su=""+new URL("assets/empty.png",import.meta.url).href;var H=(t=>(t[t.DATE=0]="DATE",t[t.VIEW=1]="VIEW",t[t.ERROR=2]="ERROR",t[t.AUTHORIZE=3]="AUTHORIZE",t[t.DELETE=4]="DELETE",t[t.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",t[t.DOWNLOAD=6]="DOWNLOAD",t[t.EDIT=7]="EDIT",t[t.ADD=8]="ADD",t[t.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",t[t.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",t))(H||{}),Ee=(t=>(t.GENERATING="generating",t.SUCCESS="success",t.FAIL="fail",t))(Ee||{});const pe={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},iu=t=>typeof t=="string"&&t in pe?pe[t]:pe.default,me=t=>{const{value:D,cell:r}=t;switch(r.columnId){case"importstatus":return D?u(fe,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:u(We,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):u(Ae,{});case"status":const d=iu(t.cell.statusType);return D=="\u5BFC\u5165\u5931\u8D25"?u(fe,{title:r.errorMsg,children:S("div",{className:"flex items-center gap-2",children:[u(he,{color:d,text:D}),u(Me,{size:14,color:"red"})]})}):u(he,{color:d,text:D});default:return u(Ae,{})}},we=[{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"}],lu=t=>{var d,C;const{cell:D,value:r}=t;return typeof r=="string"?u("div",{title:r,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r}):(d=D.tableMeta)!=null&&d.isGenDescription&&((C=D.tableMeta)==null?void 0:C.generateDescriptionStatus)=="generating"?S("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[u("span",{children:"\u751F\u6210\u4E2D"}),u(Oe,{size:14})]}):"-"},nu=({dbInfo:t,setDrawerTitle:D,setDrawerVisible:r,getBtnDisabled:d})=>S("div",{className:"flex flex-col items-center justify-center h-full",children:[u("div",{className:"text-xl font-semibold mb-3",children:u("img",{src:su,width:120})}),u("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),u("div",{className:"flex gap-3",children:u($,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:d&&d(8,t==null?void 0:t.permission),onClick:()=>{D("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),r(!0)}})})]}),ge={views:{directDB:{label:"\u6570\u636E\u8868\u7BA1\u7406",columns:{name:"\u6570\u636E\u8868\u82F1\u6587\u540D\u79F0",cnname:"\u6570\u636E\u8868\u4E2D\u6587\u540D\u79F0",colcount:"\u5B57\u6BB5\u6570",count:"\u6570\u636E\u91CF",actions:"\u64CD\u4F5C"},toolbar:{search:"\u641C\u7D22",config:"\u914D\u7F6E"}},dataTable:{label:"\u6570\u636E\u8868\u7BA1\u7406",columns:{name:"\u6587\u4EF6\u540D",description:"\u63CF\u8FF0",descriptionHelp:"\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",count:"\u6570\u636E\u91CF",status:"\u5BFC\u5165\u72B6\u6001",importStatus:"\u8FFD\u52A0\u63D0\u793A",createdAt:"\u521B\u5EFA\u65F6\u95F4",updatedAt:"\u66F4\u65B0\u65F6\u95F4",actions:"\u64CD\u4F5C"},toolbar:{upload:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",search:"\u641C\u7D22",config:"\u914D\u7F6E"},subTable:{name:"\u8FFD\u52A0\u6587\u4EF6\u540D",count:"\u6570\u636E\u91CF",status:"\u5BFC\u5165\u72B6\u6001",createdAt:"\u521B\u5EFA\u65F6\u95F4",updatedAt:"\u66F4\u6539\u65F6\u95F4",actions:"\u64CD\u4F5C"}}},actions:{view:"\u67E5\u770B",editConfig:"\u4FEE\u6539\u914D\u7F6E",appendData:"\u8FFD\u52A0\u6570\u636E",reImport:"\u91CD\u65B0\u5BFC\u5165",delete:"\u5220\u9664",deleteSub:"\u5220\u9664",uploadDataFile:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"},drawer:{uploadTitle:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",appendTitle:"\u8FFD\u52A0\u6570\u636E",editConfigTitle:"\u4FEE\u6539\u6570\u636E\u914D\u7F6E"},confirm:{deleteDatabaseTitle:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",deleteDatabaseContent:"\u8BE5\u6570\u636E\u8868\u53CA\u5176\u8FFD\u52A0\u6570\u636E\u90FD\u5C06\u88AB\u5220\u9664\u4E14\u65E0\u6CD5\u6062\u590D",deleteDataTitle:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",deleteDataContent:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okTextDelete:"\u5220\u9664",cancelText:"\u53D6\u6D88"},message:{deleteSuccess:"\u5220\u9664\u6210\u529F",deleteFailed:"\u5220\u9664\u5931\u8D25",deleteDataFailed:"\u5220\u9664\u6570\u636E\u5931\u8D25",deleteAppendSuccess:"\u8FFD\u52A0\u6587\u4EF6\u6570\u636E\u5220\u9664\u6210\u529F",editConfigSuccess:"\u4FEE\u6539\u914D\u7F6E\u6210\u529F",editConfigFailed:"\u4FEE\u6539\u914D\u7F6E\u5931\u8D25"}},ou={views:{directDB:{label:"Table management",columns:{name:"Table name (EN)",cnname:"Table name (CN)",colcount:"Columns",count:"Rows",actions:"Actions"},toolbar:{search:"Search",config:"Settings"}},dataTable:{label:"Table management",columns:{name:"File name",description:"Description",descriptionHelp:"When auto description is enabled but not generated, the description will be empty and you can fill it manually.",count:"Rows",status:"Import status",importStatus:"Append status",createdAt:"Created at",updatedAt:"Updated at",actions:"Actions"},toolbar:{upload:"Upload data file",search:"Search",config:"Settings"},subTable:{name:"Append file name",count:"Rows",status:"Import status",createdAt:"Created at",updatedAt:"Updated at",actions:"Actions"}}},actions:{view:"View",editConfig:"Edit config",appendData:"Append data",reImport:"Re-import",delete:"Delete",deleteSub:"Delete",uploadDataFile:"Upload data file"},drawer:{uploadTitle:"Upload data file",appendTitle:"Append data",editConfigTitle:"Edit table config"},confirm:{deleteDatabaseTitle:"Delete database table?",deleteDatabaseContent:"This table and its appended data will be deleted and cannot be recovered.",deleteDataTitle:"Delete data?",deleteDataContent:"This data will be permanently deleted.",okTextDelete:"Delete",cancelText:"Cancel"},message:{deleteSuccess:"Deleted successfully",deleteFailed:"Delete failed",deleteDataFailed:"Delete failed",deleteAppendSuccess:"Append file data deleted",editConfigSuccess:"Config updated",editConfigFailed:"Config update failed"}},ru={views:{directDB:{label:"\u30C6\u30FC\u30D6\u30EB\u7BA1\u7406",columns:{name:"\u30C6\u30FC\u30D6\u30EB\u540D\uFF08\u82F1\u8A9E\uFF09",cnname:"\u30C6\u30FC\u30D6\u30EB\u540D\uFF08\u4E2D\u56FD\u8A9E\uFF09",colcount:"\u5217\u6570",count:"\u30C7\u30FC\u30BF\u91CF",actions:"\u64CD\u4F5C"},toolbar:{search:"\u691C\u7D22",config:"\u8A2D\u5B9A"}},dataTable:{label:"\u30C6\u30FC\u30D6\u30EB\u7BA1\u7406",columns:{name:"\u30D5\u30A1\u30A4\u30EB\u540D",description:"\u8AAC\u660E",descriptionHelp:"\u81EA\u52D5\u8AAC\u660E\u751F\u6210\u304C\u6709\u52B9\u3067\u3082\u8AAC\u660E\u304C\u751F\u6210\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u3001\u8AAC\u660E\u306F\u7A7A\u306B\u306A\u308A\u307E\u3059\u3002\u305D\u306E\u5834\u5408\u306F\u624B\u52D5\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",count:"\u30C7\u30FC\u30BF\u91CF",status:"\u30A4\u30F3\u30DD\u30FC\u30C8\u72B6\u614B",importStatus:"\u8FFD\u52A0\u30B9\u30C6\u30FC\u30BF\u30B9",createdAt:"\u4F5C\u6210\u65E5\u6642",updatedAt:"\u66F4\u65B0\u65E5\u6642",actions:"\u64CD\u4F5C"},toolbar:{upload:"\u30C7\u30FC\u30BF\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",search:"\u691C\u7D22",config:"\u8A2D\u5B9A"},subTable:{name:"\u8FFD\u52A0\u30D5\u30A1\u30A4\u30EB\u540D",count:"\u30C7\u30FC\u30BF\u91CF",status:"\u30A4\u30F3\u30DD\u30FC\u30C8\u72B6\u614B",createdAt:"\u4F5C\u6210\u65E5\u6642",updatedAt:"\u66F4\u65B0\u65E5\u6642",actions:"\u64CD\u4F5C"}}},actions:{view:"\u8868\u793A",editConfig:"\u8A2D\u5B9A\u3092\u7DE8\u96C6",appendData:"\u30C7\u30FC\u30BF\u3092\u8FFD\u52A0",reImport:"\u518D\u30A4\u30F3\u30DD\u30FC\u30C8",delete:"\u524A\u9664",deleteSub:"\u524A\u9664",uploadDataFile:"\u30C7\u30FC\u30BF\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9"},drawer:{uploadTitle:"\u30C7\u30FC\u30BF\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",appendTitle:"\u30C7\u30FC\u30BF\u3092\u8FFD\u52A0",editConfigTitle:"\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A\u3092\u7DE8\u96C6"},confirm:{deleteDatabaseTitle:"\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",deleteDatabaseContent:"\u3053\u306E\u30C6\u30FC\u30D6\u30EB\u3068\u305D\u306E\u8FFD\u52A0\u30C7\u30FC\u30BF\u306F\u524A\u9664\u3055\u308C\u3001\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002",deleteDataTitle:"\u30C7\u30FC\u30BF\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",deleteDataContent:"\u3053\u306E\u30C7\u30FC\u30BF\u306F\u5B8C\u5168\u306B\u524A\u9664\u3055\u308C\u307E\u3059\u3002",okTextDelete:"\u524A\u9664",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB"},message:{deleteSuccess:"\u524A\u9664\u3057\u307E\u3057\u305F",deleteFailed:"\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F",deleteDataFailed:"\u30C7\u30FC\u30BF\u306E\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F",deleteAppendSuccess:"\u8FFD\u52A0\u30D5\u30A1\u30A4\u30EB\u306E\u30C7\u30FC\u30BF\u3092\u524A\u9664\u3057\u307E\u3057\u305F",editConfigSuccess:"\u8A2D\u5B9A\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F",editConfigFailed:"\u8A2D\u5B9A\u306E\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F"}},cu={zh:ge,en:ou,ja:ru};function du(t,D){const r=cu[t]??ge;return D?{...r,...D}:r}const Le=se.createContext({locale:"zh",messages:ge});function Fu(){return se.useContext(Le)}function pu({locale:t,messages:D,children:r}){const d=se.useMemo(()=>({locale:t,messages:du(t,D)}),[t,D]);return se.createElement(Le.Provider,{value:d},r)}const{confirm:ve}=be;function mu(t,D){const{url:r,token:d,role:C,id:f,dbType:z,CustomComponents:X,getBtnDisabled:E,uploadUrl:L}=t,{messages:s}=Fu(),[Y,_]=b({container:"ready",content:"ready"}),A=Ce(null),m=Ce(null),[W,U]=b(),[a,i]=b({}),[l,n]=b(),[y,B]=b(!1),[N,p]=b(""),[h,Z]=b(),[O,q]=b(!1),[ie,le]=b(""),{getTableList:ne,delTableById:K,delFileById:oe,updateTableInfo:ee,optimizeDesc:ue,getTableTreeList:te,reParseFile:re,getDBDetailById:ce}=ze({url:r,token:d,role:C,eventsEmit:t.eventsEmit});Te(()=>(f&&z&&(_(o=>({...o,container:"loading"})),ae()),()=>{m.current&&(clearTimeout(m.current),m.current=null)}),[f,z]);const ae=async()=>{try{const o=await ce(f,z);o&&(n(o),_(e=>({...e,container:"ready",content:"loading"})))}catch(o){console.log("[TableApiError] getDBInfo:",o)}await J()};Re(D,()=>({getDatabaseDetail:ae}));const de=async()=>{try{if(z=="DirectDB"){const o=await ne(f);if(o){const e=c(o);return U(e||[]),_(V=>({...V,content:"ready"})),e||[]}else _(e=>({...e,content:"error"}))}else{const o=await te(f);if(o){const e=F(o);return U(e||[]),_(V=>({...V,content:"ready"})),e||[]}else _(e=>({...e,content:"error"}))}}catch(o){console.log("[TableApiError] getTableList:",o)}};function F(o){return(o||[]).map((e,V)=>{var w,k;let g=we.find(v=>v.status==e.status);const I=e.children.some(v=>v.status=="00");return{id:e.fileId.toString(),tableId:e.tableId,data:[{columnId:"name",value:(e==null?void 0:e.originalFilename)||"-",type:"label"},{columnId:"description",value:(w=e==null?void 0:e.tableMeta)==null?void 0:w.description,type:"customized",tableMeta:e==null?void 0:e.tableMeta},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`,type:"text"},{columnId:"status",...g,type:"customized",errorMsg:e.errorMsg},{columnId:"importstatus",value:I,type:"customized"},{columnId:"createdAt",value:e.gmtCreate,type:"date"},{columnId:"updatedAt",value:e.gmtModified,type:"date"},...e.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,e.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:E&&E(H.EDIT,e.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:E&&E(H.EDIT,e.permission)}]:[],...e.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,e.permission)}],expanded:!1,...e.children&&((k=e.children)==null?void 0:k.length)>0&&{children:[...(e.children||[]).map(v=>{const Ve=we.find(Ne=>Ne.status==v.status),_e=[{columnId:"name",value:v.originalFilename,type:"text"},{columnId:"count",value:`${v.rowCount}\u884C\uFF0C${v.columnCount}\u5217`,type:"text"},{columnId:"status",...Ve,errorMsg:v.errorMsg,type:"customized"},{columnId:"createdAt",value:v.gmtCreate,type:"date"},{columnId:"updatedAt",value:v.gmtModified,type:"date"},...v.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,v.permission)}]:[],...v.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:E&&E(H.ADD,v.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:E&&E(H.DELETE,v.permission)}];return{id:v.fileId.toString(),tableId:v.tableId,data:_e}})]}}})}function c(o){return(o||[]).map((e,V)=>({id:e.id||Ue(8),data:[{columnId:"name",value:e.physicalName},{columnId:"cnname",value:e.businessName},{columnId:"colcount",value:e.columnCount},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`},{columnId:"actions",value:"view",label:"\u67E5\u770B",disabled:E&&E(H.VIEW,e.permission)}]}))}async function M(o,e,V){switch(console.log("[adopter] mergedEventsEmit",o,e,V),o){case"table_action_delete":{try{if(console.log("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E:",e),!e||!e.tableId&&!e.id){console.error("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E\u4E0D\u5B8C\u6574:",e),G.error("\u5220\u9664\u5931\u8D25\uFF1A\u6570\u636E\u4E0D\u5B8C\u6574");return}const g=e.tableId||e.id,I=e.id;ve({title:s.confirm.deleteDatabaseTitle,content:s.confirm.deleteDatabaseContent,icon:u(Me,{color:"#FF4D4F",className:"mr-[8px]"}),okText:s.confirm.okTextDelete,cancelText:s.confirm.cancelText,async onOk(){await K(g,z)&&(A!=null&&A.current)?(A==null||A.current.appFn.removeItem(I),G.success(s.message.deleteSuccess)):G.error(s.message.deleteFailed)}})}catch(g){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25:",g),G.error("\u5220\u9664\u5931\u8D25")}break}case"table_action_edit":{le(s.drawer.editConfigTitle),q(!0),Z(e);break}case"toolbar_upload":{p(s.drawer.uploadTitle),B(!0);break}case"table_action_addData":{p(s.drawer.appendTitle),B(!0),Z(e);break}case"table_action_reValidate":{await re(e.id)&&(m.current&&(clearTimeout(m.current),m.current=null),await J());break}case"table_info:update":{try{if(h!=null&&h.id){const g=(h==null?void 0:h.data.find(w=>w.columnId=="name").value)||"-";if(await ee({tableId:h.tableId,description:e,businessName:g})&&(A!=null&&A.current)){const w={...h,data:h.data.map(k=>k.columnId=="description"?{...k,value:e}:k)};A==null||A.current.appFn.updateItem(w,h.id),G.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(g){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",g)}finally{x()}break}case"table_action_delete_sub":{try{ve({title:s.confirm.deleteDataTitle,content:s.confirm.deleteDataContent,okText:s.confirm.okTextDelete,cancelText:s.confirm.cancelText,async onOk(){const{id:g,tableId:I}=e;await oe(e.id)&&(A!=null&&A.current)&&(i(k=>({...k,[I]:[...k[I]||[],g]})),e.data.find(k=>k.status=="00")&&(m.current&&(clearTimeout(m.current),m.current=null),J()),V.removeItem(g,I),G.success(s.message.deleteAppendSuccess))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25"),G.error(s.message.deleteDataFailed)}break}case"toolbar_auth":{typeof t.eventsEmit=="function"&&t.eventsEmit("toolbar_auth",l);break}default:typeof t.eventsEmit=="function"&&t.eventsEmit(o,e);break}}const T=Q(()=>({label:s.views.directDB.label,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:s.views.directDB.columns.name,type:"label"},{id:"cnname",title:s.views.directDB.columns.cnname,type:"label"},{id:"colcount",title:s.views.directDB.columns.colcount,type:"text"},{id:"count",title:s.views.directDB.columns.count,type:"text"},{id:"actions",title:s.views.directDB.columns.actions,type:"action"}],toolbar:[{type:"fuzzy_search",key:"search",label:s.views.directDB.toolbar.search,searchKeys:["name","description"],position:"right"},{type:"button",key:"auth",label:s.views.directDB.toolbar.config,btnType:"default",position:"right"}]}]}),[W,z]),R=Q(()=>({label:s.views.dataTable.label,model:null,defaultActiveId:"data-table-view",views:[{label:s.views.dataTable.label,id:"data-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"name",title:s.views.dataTable.columns.name,type:"label",tip:s.views.dataTable.columns.name},{id:"description",title:s.views.dataTable.columns.description,type:"customized",component:u(lu,{}),helpText:s.views.dataTable.columns.descriptionHelp},{id:"count",title:s.views.dataTable.columns.count,type:"text",tip:s.views.dataTable.columns.count},{id:"status",title:s.views.dataTable.columns.status,type:"customized",component:u(me,{})},{id:"importstatus",title:s.views.dataTable.columns.importStatus,type:"customized",component:u(me,{})},{id:"createdAt",title:s.views.dataTable.columns.createdAt,type:"date",tip:s.views.dataTable.columns.createdAt},{id:"updatedAt",title:s.views.dataTable.columns.updatedAt,type:"date",tip:s.views.dataTable.columns.updatedAt},{id:"actions",title:s.views.dataTable.columns.actions,type:"action"}],toolbar:[{type:"button",key:"upload",label:s.actions.uploadDataFile,btnType:"primary",disabled:E&&E(H.ADD,l==null?void 0:l.permission),icon:u($e,{size:12})},{type:"fuzzy_search",key:"search",label:s.views.dataTable.toolbar.search,searchKeys:["name","description",["name"]],position:"right"},{type:"button",key:"auth",label:s.views.dataTable.toolbar.config,btnType:"default",position:"right"}]}],subTableConfig:{type:"table",allowMultiSelect:!1,viewBehavior:"pagination",viewPageSize:5,columns:[{title:s.views.dataTable.subTable.name,id:"name",type:"text",tip:s.views.dataTable.subTable.name},{title:s.views.dataTable.subTable.count,id:"count",type:"text",tip:s.views.dataTable.subTable.count},{id:"status",title:s.views.dataTable.subTable.status,type:"customized",tip:s.views.dataTable.subTable.status,component:u(me,{})},{title:s.views.dataTable.subTable.createdAt,id:"createdAt",type:"date",tip:s.views.dataTable.subTable.createdAt},{title:s.views.dataTable.subTable.updatedAt,id:"updatedAt",type:"date",tip:s.views.dataTable.subTable.updatedAt},{title:s.views.dataTable.subTable.actions,id:"actions",type:"action"}]},subTablePendingIds:a,onSubTableRowAnimationComplete:(o,e)=>{i(V=>({...V,[o]:(V[o]||[]).filter(g=>g!==e)}))}}),[a,W,z,l,s]),x=o=>{B(!1),q(!1),Z(void 0),o=="refresh"&&(m.current&&(clearTimeout(m.current),m.current=null),J())};function j(o){var e,V;if(!Array.isArray(o))return!0;for(const g of o){if(g.data){const I=g.data.find(k=>k.columnId==="status"),w=g.data.find(k=>k.columnId==="description");if(console.log("+++++",I.status==="20"||I.status==="11"||((e=w==null?void 0:w.tableMeta)==null?void 0:e.generateDescriptionStatus)==Ee.GENERATING),I&&(I.status==="20"||I.status==="11"||((V=w==null?void 0:w.tableMeta)==null?void 0:V.generateDescriptionStatus)==Ee.GENERATING))return!1}if(Array.isArray(g.children)){for(const I of g.children)if(I.data){const w=I.data.find(k=>k.columnId==="status");if(w&&(w.status==="20"||w.status==="11"))return!1}}}return!0}const J=async()=>{const o=await de();j(o||[])?m.current&&(clearTimeout(m.current),m.current=null):(m.current&&(clearTimeout(m.current),m.current=null),m.current=setTimeout(()=>{J()},5e3))};return S(Ze,{title:l==null?void 0:l.name,description:(l==null?void 0:l.description)||"-",goBack:()=>{var o;(o=t.eventsEmit)==null||o.call(t,"goBack",{})},children:[u(Ie,{dataSource:W,ref:A,eventsEmit:M,status:Y,styles:{theme:{...Be,colors:{...Be.colors,tableFirstColumnBg:"#ffffff",tableLastColumnBg:"#ffffff",paginationBackground:"#ffffff",subTableBackground:"#F5F5F5",tableHeaderBg:"#F5F5F5"}},mode:"light"},CustomComponents:{EmptyData:()=>u(nu,{dbInfo:l,setDrawerTitle:p,setDrawerVisible:B,getBtnDisabled:E}),...X},...z=="DataTable"?R:T}),u(Je,{drawerTitle:N,drawerVisible:y,handleDrawerClose:x,dbId:f,token:d,url:r,uploadUrl:L,role:C,tableInfo:h}),u(au,{drawerTitle:ie,drawerVisible:O,handleDrawerClose:x,tableInfo:h,optimizeDesc:ue,eventsEmit:M})]})}const Cu=xe(mu),Vu=xe(function(D,r){const{locale:d="zh",messages:C,...f}=D;return u(pu,{locale:d,messages:C,children:u(Cu,{...f,ref:r})})});export{Le as DatabaseIdI18nContext,pu as DatabaseIdI18nProvider,Vu as default,du as getDatabaseIdMessages,Fu as useDatabaseIdI18n};
|
package/databaseTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsxs as Y,jsx as N}from"react/jsx-runtime";import*as f from"react";import F,{useContext as de,Children as $e,useState as G,useRef as Le,useEffect as Ne,useMemo as
|
|
1
|
+
import{jsxs as Y,jsx as N}from"react/jsx-runtime";import*as f from"react";import F,{useContext as de,Children as $e,useState as G,useRef as Le,useEffect as Ne,useMemo as ze}from"react";import{u as ce}from"./assets/index-CpW6Dhpp.js";import{c as Pe,C as ge,j as k,o as Fe,y as ue,a as Me,m as Te,s as E,r as _e,u as Ae,z as Oe,A as je,B as ye,D as Re,E as be,R as xe,G as He,w as qe,H as We,J as Ge}from"./assets/index-DHK_n74G.js";import{Y as Se,N as ke}from"./assets/index-DPA1HCWQ.js";import{D as Ve}from"./assets/index-CzZQWA2P.js";import{P as Xe,S as Ue}from"./assets/index-B4k3tK0f.js";import{X as Je}from"./assets/x-DWGzNb9c.js";import{z as Ke}from"./assets/index-Dj91ulxd.js";/* empty css *//* empty css */import{M as Ye,s as Ce}from"./assets/index-iOuQJ8vu.js";import"react-dom";import"./assets/LeftOutlined-DZMeGbKk.js";/**
|
|
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 Qe=ze("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"}]]),pe=F.createContext({});pe.Consumer;var ve=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};const Ze=t=>{var{prefixCls:e,className:i,avatar:n,title:o,description:p}=t,$=ve(t,["prefixCls","className","avatar","title","description"]);const{getPrefixCls:y}=de(ge),h=y("list",e),a=k(`${h}-item-meta`,i),d=F.createElement("div",{className:`${h}-item-meta-content`},o&&F.createElement("h4",{className:`${h}-item-meta-title`},o),p&&F.createElement("div",{className:`${h}-item-meta-description`},p));return F.createElement("div",Object.assign({},$,{className:a}),n&&F.createElement("div",{className:`${h}-item-meta-avatar`},n),(o||p)&&d)},et=F.forwardRef((t,e)=>{const{prefixCls:i,children:n,actions:o,extra:p,styles:$,className:y,classNames:h,colStyle:a}=t,d=ve(t,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:s,itemLayout:r}=de(pe),{getPrefixCls:g,list:u}=de(ge),D=I=>{var v,O;return k((O=(v=u==null?void 0:u.item)===null||v===void 0?void 0:v.classNames)===null||O===void 0?void 0:O[I],h==null?void 0:h[I])},x=I=>{var v,O;return Object.assign(Object.assign({},(O=(v=u==null?void 0:u.item)===null||v===void 0?void 0:v.styles)===null||O===void 0?void 0:O[I]),$==null?void 0:$[I])},A=()=>{let I=!1;return $e.forEach(n,v=>{typeof v=="string"&&(I=!0)}),I&&$e.count(n)>1},L=()=>r==="vertical"?!!p:!A(),S=g("list",i),P=o&&o.length>0&&F.createElement("ul",{className:k(`${S}-item-action`,D("actions")),key:"actions",style:x("actions")},o.map((I,v)=>F.createElement("li",{key:`${S}-item-action-${v}`},I,v!==o.length-1&&F.createElement("em",{className:`${S}-item-action-split`})))),q=s?"div":"li",R=F.createElement(q,Object.assign({},d,s?{}:{ref:e},{className:k(`${S}-item`,{[`${S}-item-no-flex`]:!L()},y)}),r==="vertical"&&p?[F.createElement("div",{className:`${S}-item-main`,key:"content"},n,P),F.createElement("div",{className:k(`${S}-item-extra`,D("extra")),key:"extra",style:x("extra")},p)]:[n,P,Fe(p,{key:"extra"})]);return s?F.createElement(ue,{ref:e,flex:1,style:a},R):R}),Ee=et;Ee.Meta=Ze;const tt=t=>{const{listBorderedCls:e,componentCls:i,paddingLG:n,margin:o,itemPaddingSM:p,itemPaddingLG:$,marginLG:y,borderRadiusLG:h}=t,a=E(t.calc(h).sub(t.lineWidth).equal());return{[e]:{border:`${E(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:h,[`${i}-header`]:{borderRadius:`${a} ${a} 0 0`},[`${i}-footer`]:{borderRadius:`0 0 ${a} ${a}`},[`${i}-header,${i}-footer,${i}-item`]:{paddingInline:n},[`${i}-pagination`]:{margin:`${E(o)} ${E(y)}`}},[`${e}${i}-sm`]:{[`${i}-item,${i}-header,${i}-footer`]:{padding:p}},[`${e}${i}-lg`]:{[`${i}-item,${i}-header,${i}-footer`]:{padding:$}}}},at=t=>{const{componentCls:e,screenSM:i,screenMD:n,marginLG:o,marginSM:p,margin:$}=t;return{[`@media screen and (max-width:${n}px)`]:{[e]:{[`${e}-item`]:{[`${e}-item-action`]:{marginInlineStart:o}}},[`${e}-vertical`]:{[`${e}-item`]:{[`${e}-item-extra`]:{marginInlineStart:o}}}},[`@media screen and (max-width: ${i}px)`]:{[e]:{[`${e}-item`]:{flexWrap:"wrap",[`${e}-action`]:{marginInlineStart:p}}},[`${e}-vertical`]:{[`${e}-item`]:{flexWrap:"wrap-reverse",[`${e}-item-main`]:{minWidth:t.contentWidth},[`${e}-item-extra`]:{margin:`auto auto ${E($)}`}}}}}},it=t=>{const{componentCls:e,antCls:i,controlHeight:n,minHeight:o,paddingSM:p,marginLG:$,padding:y,itemPadding:h,colorPrimary:a,itemPaddingSM:d,itemPaddingLG:s,paddingXS:r,margin:g,colorText:u,colorTextDescription:D,motionDurationSlow:x,lineWidth:A,headerBg:L,footerBg:S,emptyTextPadding:P,metaMarginBottom:q,avatarMarginRight:R,titleMarginBottom:I,descriptionFontSize:v}=t;return{[e]:Object.assign(Object.assign({},_e(t)),{position:"relative","--rc-virtual-list-scrollbar-bg":t.colorSplit,"*":{outline:"none"},[`${e}-header`]:{background:L},[`${e}-footer`]:{background:S},[`${e}-header, ${e}-footer`]:{paddingBlock:p},[`${e}-pagination`]:{marginBlockStart:$,[`${i}-pagination-options`]:{textAlign:"start"}},[`${e}-spin`]:{minHeight:o,textAlign:"center"},[`${e}-items`]:{margin:0,padding:0,listStyle:"none"},[`${e}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:h,color:u,[`${e}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${e}-item-meta-avatar`]:{marginInlineEnd:R},[`${e}-item-meta-content`]:{flex:"1 0",width:0,color:u},[`${e}-item-meta-title`]:{margin:`0 0 ${E(t.marginXXS)} 0`,color:u,fontSize:t.fontSize,lineHeight:t.lineHeight,"> a":{color:u,transition:`all ${x}`,"&:hover":{color:a}}},[`${e}-item-meta-description`]:{color:D,fontSize:v,lineHeight:t.lineHeight}},[`${e}-item-action`]:{flex:"0 0 auto",marginInlineStart:t.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${E(r)}`,color:D,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${e}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:A,height:t.calc(t.fontHeight).sub(t.calc(t.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:t.colorSplit}}},[`${e}-empty`]:{padding:`${E(y)} 0`,color:D,fontSize:t.fontSizeSM,textAlign:"center"},[`${e}-empty-text`]:{padding:P,color:t.colorTextDisabled,fontSize:t.fontSize,textAlign:"center"},[`${e}-item-no-flex`]:{display:"block"}}),[`${e}-grid ${i}-col > ${e}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:g,paddingBlock:0,borderBlockEnd:"none"},[`${e}-vertical ${e}-item`]:{alignItems:"initial",[`${e}-item-main`]:{display:"block",flex:1},[`${e}-item-extra`]:{marginInlineStart:$},[`${e}-item-meta`]:{marginBlockEnd:q,[`${e}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:I,color:u,fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}},[`${e}-item-action`]:{marginBlockStart:y,marginInlineStart:"auto","> li":{padding:`0 ${E(y)}`,"&:first-child":{paddingInlineStart:0}}}},[`${e}-split ${e}-item`]:{borderBlockEnd:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${e}-split ${e}-header`]:{borderBlockEnd:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-split${e}-empty ${e}-footer`]:{borderTop:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-loading ${e}-spin-nested-loading`]:{minHeight:n},[`${e}-split${e}-something-after-last-item ${i}-spin-container > ${e}-items > ${e}-item:last-child`]:{borderBlockEnd:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-lg ${e}-item`]:{padding:s},[`${e}-sm ${e}-item`]:{padding:d},[`${e}:not(${e}-vertical)`]:{[`${e}-item-no-flex`]:{[`${e}-item-action`]:{float:"right"}}}}},nt=t=>({contentWidth:220,itemPadding:`${E(t.paddingContentVertical)} 0`,itemPaddingSM:`${E(t.paddingContentVerticalSM)} ${E(t.paddingContentHorizontal)}`,itemPaddingLG:`${E(t.paddingContentVerticalLG)} ${E(t.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:t.padding,metaMarginBottom:t.padding,avatarMarginRight:t.padding,titleMarginBottom:t.paddingSM,descriptionFontSize:t.fontSize}),st=Me("List",t=>{const e=Te(t,{listBorderedCls:`${t.componentCls}-bordered`,minHeight:t.controlHeightLG});return[it(e),tt(e),at(e)]},nt);var ot=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};function rt(t,e){const{pagination:i=!1,prefixCls:n,bordered:o=!1,split:p=!0,className:$,rootClassName:y,style:h,children:a,itemLayout:d,loadMore:s,grid:r,dataSource:g=[],size:u,header:D,footer:x,loading:A=!1,rowKey:L,renderItem:S,locale:P}=t,q=ot(t,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),R=i&&typeof i=="object"?i:{},[I,v]=f.useState(R.defaultCurrent||1),[O,te]=f.useState(R.defaultPageSize||10),{getPrefixCls:ae,direction:ie,className:ne,style:se}=Ae("list"),{renderEmpty:J}=f.useContext(ge),l={current:1,total:0,position:"bottom"},c=C=>(_,W)=>{var le;v(_),te(W),i&&((le=i==null?void 0:i[C])===null||le===void 0||le.call(i,_,W))},b=c("onChange"),M=c("onShowSizeChange"),H=(C,_)=>{if(!S)return null;let W;return typeof L=="function"?W=L(C):L?W=C[L]:W=C.key,W||(W=`list-item-${_}`),f.createElement(f.Fragment,{key:W},S(C,_))},T=!!(s||i||x),m=ae("list",n),[V,B,z]=st(m);let j=A;typeof j=="boolean"&&(j={spinning:j});const U=!!(j!=null&&j.spinning),K=Oe(u);let X="";switch(K){case"large":X="lg";break;case"small":X="sm";break}const Q=k(m,{[`${m}-vertical`]:d==="vertical",[`${m}-${X}`]:X,[`${m}-split`]:p,[`${m}-bordered`]:o,[`${m}-loading`]:U,[`${m}-grid`]:!!r,[`${m}-something-after-last-item`]:T,[`${m}-rtl`]:ie==="rtl"},ne,$,y,B,z),w=je(l,{total:g.length,current:I,pageSize:O},i||{}),De=Math.ceil(w.total/w.pageSize);w.current=Math.min(w.current,De);const fe=i&&f.createElement("div",{className:k(`${m}-pagination`)},f.createElement(Xe,Object.assign({align:"end"},w,{onChange:b,onShowSizeChange:M})));let oe=ye(g);i&&g.length>(w.current-1)*w.pageSize&&(oe=ye(g).splice((w.current-1)*w.pageSize,w.pageSize));const we=Object.keys(r||{}).some(C=>["xs","sm","md","lg","xl","xxl"].includes(C)),he=Re(we),Z=f.useMemo(()=>{for(let C=0;C<be.length;C+=1){const _=be[C];if(he[_])return _}},[he]),Ie=f.useMemo(()=>{if(!r)return;const C=Z&&r[Z]?r[Z]:r.column;if(C)return{width:`${100/C}%`,maxWidth:`${100/C}%`}},[JSON.stringify(r),Z]);let re=U&&f.createElement("div",{style:{minHeight:53}});if(oe.length>0){const C=oe.map(H);re=r?f.createElement(xe,{gutter:r.gutter},f.Children.map(C,_=>f.createElement("div",{key:_==null?void 0:_.key,style:Ie},_))):f.createElement("ul",{className:`${m}-items`},C)}else!a&&!U&&(re=f.createElement("div",{className:`${m}-empty-text`},(P==null?void 0:P.emptyText)||(J==null?void 0:J("List"))||f.createElement(He,{componentName:"List"})));const ee=w.position,Be=f.useMemo(()=>({grid:r,itemLayout:d}),[JSON.stringify(r),d]);return V(f.createElement(pe.Provider,{value:Be},f.createElement("div",Object.assign({ref:e,style:Object.assign(Object.assign({},se),h),className:Q},q),(ee==="top"||ee==="both")&&fe,D&&f.createElement("div",{className:`${m}-header`},D),f.createElement(Je,Object.assign({},j),re,a),x&&f.createElement("div",{className:`${m}-footer`},x),s||(ee==="bottom"||ee==="both")&&fe)))}const lt=f.forwardRef(rt),me=lt;me.Item=Ee;const ct=({url:t,token:e,role:i,eventsEmit:n})=>{const o=qe.create({baseURL:t,timeout:1e6});return o.interceptors.request.use(a=>{let d=e;return!d&&!["user/login","user/kaptcha","user/regist"].some(r=>a.url.includes(r))?(n&&n("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(a.headers.Authorization=d||"",a.headers.userName=i==="\u672A\u767B\u5F55\u7528\u6237"?"":i,a)}),o.interceptors.response.use(a=>{const d=["user/kaptcha"],s=a.data;if(d.some(D=>a.config.url&&a.config.url.includes(D))||s.size&&s.type)return s;const{success:r,errorMsg:g,errorCode:u}=s;return r?s:(n&&n("request:error_business",{errorCode:u,errorMsg:g||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:s}),!1)},a=>{var d,s,r,g,u,D,x,A,L;if(a.message==="canceled")return Promise.reject(a);if(n){let S="request:error_network",P={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:a};((d=a==null?void 0:a.response)==null?void 0:d.status)===401?(S="request:error_auth",P={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:a,redirect:"/login"}):(((r=(s=a==null?void 0:a.response)==null?void 0:s.data)==null?void 0:r.errorCode)==="30013"||((u=(g=a==null?void 0:a.response)==null?void 0:g.data)==null?void 0:u.errorCode)==="30023")&&(S="request:error_business",P={errorCode:(x=(D=a==null?void 0:a.response)==null?void 0:D.data)==null?void 0:x.errorCode,errorMsg:((L=(A=a==null?void 0:a.response)==null?void 0:A.data)==null?void 0:L.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:a}),n(S,P)}return Promise.reject(a)}),{getTableDataList:async({dbId:a,name:d,params:s})=>{try{const r=await o.get(`/directDB/queryTableData/${a}/${d}?${new URLSearchParams(s).toString()}`),{success:g,data:u}=r;if(g)return u}catch(r){return console.log("getTableDataList error:",r),!1}},updateTableData:async(a,d)=>{try{const s=await o.post(`/dataTable/dataUpdateRow/${a}`,{...d}),{success:r,data:g}=s;if(r)return g}catch(s){return console.log("updateTableData error:",s),!1}},delTableDataById:async({tableId:a,rowId:d})=>{try{const s=await o.delete(`/dataTable/dataDeleteRow/${a}/${d}`),{success:r,data:g}=s;if(r)return g}catch(s){console.log("delTableDataById error:",s)}},getFileDataList:async({fileId:a,params:d})=>{try{const s=await o.get(`/dataTable/queryTableFileData/${a}?${new URLSearchParams(d).toString()}`),{success:r,data:g}=s;return r?g:!1}catch(s){return console.log("e",s),!1}}}},dt=({drawerVisible:t,handleDrawerClose:e,rowData:i})=>{const[n,o]=G(i.data),[p,$]=G(null),[y,h]=G(""),a=s=>{h(s.value),$(s.columnId)},d=s=>{y.trim()&&(o(n.map(r=>r.columnId===s?{...r,value:y}:r)),$(null))};return Y(Ve,{title:"\u5217\u6570\u503C\u4FEE\u6539",placement:"right",width:840,onClose:()=>e("cancel"),open:t,closeIcon:!1,extra:N(Ue,{size:20,color:"#888888",onClick:()=>e("cancel"),className:"cursor-pointer"}),footer:Y("div",{className:"flex justify-end items-center gap-3",style:{justifyContent:"end"},children:[N(Se,{mode:"default",label:"\u53D6\u6D88",onClick:()=>e("cancel")}),N(Se,{mode:"primary",label:"\u786E\u8BA4",onClick:async()=>{await e("confirm",n)}})]}),children:[Y(xe,{gutter:16,style:{padding:"12px 18px",background:"#fafafa",borderBottom:"1px solid #f0f0f0",fontWeight:"bold"},children:[N(ue,{span:4,children:"\u5217\u540D\u79F0"}),N(ue,{span:20,children:"\u6570\u503C"})]}),N(me,{dataSource:n,renderItem:s=>N(me.Item,{actions:[p!==s.columnId&&N(Ge,{type:"text",icon:N(Qe,{size:14}),onClick:()=>a(s)})],children:Y("div",{style:{display:"flex",width:"100%",height:"54px",lineHeight:"54px"},children:[N("div",{style:{width:"150px",marginLeft:15},children:s.columnName}),N("div",{style:{width:"550px"},children:p===s.columnId?N(We,{value:y,onChange:r=>h(r.target.value),onPressEnter:()=>d(s.columnId),onBlur:()=>d(s.columnId)}):N("div",{className:"w-full truncate",title:s.value,children:s.value})})]})})})]})},{confirm:ut}=Ye;function wt({url:t,token:e,fileId:i,role:n,dbType:o,dbId:p,tableId:$,tableName:y,CustomComponents:h,eventsEmit:a,getBtnDisabled:d}){const[s,r]=G(!1),g=Le(null),[u,D]=G(),[x,A]=G(),[L,S]=G(),[P,q]=G({app:"ready",container:"ready",content:"ready"}),{getTableDataList:R,updateTableData:I,delTableDataById:v,getFileDataList:O}=ct({url:t,token:e,role:n,eventsEmit:a});Ne(()=>{q(l=>({...l,content:"loading"})),te()},[]);const te=async()=>{try{if(o=="DirectDB"){const l=await R({dbId:p,name:y,params:{pageNo:1,pageSize:60}});l&&(l.columns=((l==null?void 0:l.columns)||[]).map(c=>({...c,id:c.id||ce(4)})),l.dataList=(l.dataList||[]).map((c,b)=>({...c,__absIndex:b})),A(l),S(l.permission),q(c=>({...c,content:"ready"})))}else{const l=await O({fileId:i,params:{pageNo:1,pageSize:60}});l&&(l.dataList=(l.dataList||[]).map((c,b)=>({...c,__absIndex:b})),l.columns=((l==null?void 0:l.columns)||[]).map(c=>({...c,id:c.id||ce(4)})),A(l),S(l.permission),q(c=>({...c,content:"ready"})))}}catch(l){console.log("[DatabaseApiError] getDataList:",l)}},ae=l=>((l==null?void 0:l.dataList)||[]).map(b=>{const H=((l==null?void 0:l.columns)||[]).filter(T=>T.physicalName!=="id").map(T=>({columnId:T.id,columnName:T.businessName,physicalName:T.physicalName,value:b[T.physicalName]||"-",type:b.dataType=="DATETIME"?"date":"paragraph"}));return o=="DataTable"&&H.push({columnId:"actions",value:"edit",label:"\u4FEE\u6539",disabled:d&&d(7,L)},{columnId:"actions",value:"delete",label:"\u5220\u9664",disabled:d&&d(4,L)}),{id:b.id,data:H,__absIndex:b.__absIndex}}),ie=l=>{const b=((l==null?void 0:l.columns)||[]).filter(M=>M.physicalName!=="id").map(M=>({title:o=="DirectDB"?M.physicalName:M.businessName,id:M.id,type:M.dataType=="DATETIME"?"date":"paragraph"}));return o=="DataTable"&&b.push({id:"actions",title:"\u64CD\u4F5C",type:"action"}),b},ne=async(l,c,b)=>{var M,H;switch(console.log("[DatabaseTableView] eventsEmit:",l,c,b),l){case"pagination:request_merge_data":{try{const m=(M=c==null?void 0:c.request)==null?void 0:M.pageNo,V=(H=c==null?void 0:c.request)==null?void 0:H.pageSize;if(!m||!V)return;let B;o=="DirectDB"?B=await R({dbId:p,name:y,params:{pageNo:m,pageSize:V}}):B=await O({fileId:i,params:{pageNo:m,pageSize:V}}),B&&(B.dataList=(B.dataList||[]).map((z,j)=>({...z,__absIndex:(m-1)*V+j})),B.columns=((B==null?void 0:B.columns)||[]).map(z=>({...z,id:z.id||ce(4)})),A(z=>{var Q;if(!z)return B;const j=Array.isArray(z.dataList)?z.dataList:[],U=Array.isArray(B.dataList)?B.dataList:[],K=new Map;j.forEach(w=>K.set(w.id,w)),U.forEach(w=>K.set(w.id,w));const X=Array.from(K.values());return{...z,dataList:X,total:z.total??B.total,columns:(Q=z.columns)!=null&&Q.length?z.columns:B.columns}}))}catch(m){console.log("[DatabaseApiError] pagination:request_merge_data:",m)}break}case"table_action_edit":r(!0);const T=(c.data||[]).filter(m=>m.columnId!=="actions");D({id:c.id,data:T});break;case"table_action_delete":try{ut({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 v({tableId:$,rowId:c.id})&&(Ce.success("\u8868\u6570\u636E\u5220\u9664\u6210\u529F"),b.removeItem(c.id))},onCancel(){console.log("Cancel")}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break;default:a==null||a(l,c);break}},se=async(l,c)=>{if(l=="confirm")try{const b=c.reduce((H,T)=>(H[T.physicalName]=T.value,H),{});await I($,{...b,id:u==null?void 0:u.id})&&g.current&&(Ce.success("\u6570\u636E\u4FEE\u6539\u6210\u529F"),g.current.appFn.updateItem(c,u==null?void 0:u.id))}catch(b){console.log("[TableRowApiError] updateTableData:",b)}r(!1),D(void 0)},J=Pe(()=>({label:"\u6570\u636E\u5E93\u8868\u683C",defaultActiveId:"database-table",model:null,views:[{label:"\u6570\u636E\u8868\u540D\u79F0",id:"database-table",type:"table",total:(x==null?void 0:x.totalData)||999,requestPagesize:60,viewPageSize:10,allowMultiSelect:!1,columns:ie(x),viewBehavior:"pagination"}],dataSource:ae(x),eventsEmit:ne}),[x,a,o,L]);return Y(ke,{title:y,goBack:()=>{a==null||a("goBack",{})},children:[N(Ke,{ref:g,status:P,CustomComponents:{...h},...J},"table-data"),u&&N(dt,{drawerVisible:s,tableId:i,handleDrawerClose:se,rowData:u})]})}export{wt as default};
|
|
6
|
+
*/const Qe=Pe("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"}]]),pe=F.createContext({});pe.Consumer;var ve=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};const Ze=t=>{var{prefixCls:e,className:i,avatar:n,title:o,description:p}=t,$=ve(t,["prefixCls","className","avatar","title","description"]);const{getPrefixCls:y}=de(ge),h=y("list",e),a=k(`${h}-item-meta`,i),d=F.createElement("div",{className:`${h}-item-meta-content`},o&&F.createElement("h4",{className:`${h}-item-meta-title`},o),p&&F.createElement("div",{className:`${h}-item-meta-description`},p));return F.createElement("div",Object.assign({},$,{className:a}),n&&F.createElement("div",{className:`${h}-item-meta-avatar`},n),(o||p)&&d)},et=F.forwardRef((t,e)=>{const{prefixCls:i,children:n,actions:o,extra:p,styles:$,className:y,classNames:h,colStyle:a}=t,d=ve(t,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:s,itemLayout:r}=de(pe),{getPrefixCls:g,list:u}=de(ge),D=I=>{var v,O;return k((O=(v=u==null?void 0:u.item)===null||v===void 0?void 0:v.classNames)===null||O===void 0?void 0:O[I],h==null?void 0:h[I])},x=I=>{var v,O;return Object.assign(Object.assign({},(O=(v=u==null?void 0:u.item)===null||v===void 0?void 0:v.styles)===null||O===void 0?void 0:O[I]),$==null?void 0:$[I])},A=()=>{let I=!1;return $e.forEach(n,v=>{typeof v=="string"&&(I=!0)}),I&&$e.count(n)>1},L=()=>r==="vertical"?!!p:!A(),S=g("list",i),z=o&&o.length>0&&F.createElement("ul",{className:k(`${S}-item-action`,D("actions")),key:"actions",style:x("actions")},o.map((I,v)=>F.createElement("li",{key:`${S}-item-action-${v}`},I,v!==o.length-1&&F.createElement("em",{className:`${S}-item-action-split`})))),q=s?"div":"li",R=F.createElement(q,Object.assign({},d,s?{}:{ref:e},{className:k(`${S}-item`,{[`${S}-item-no-flex`]:!L()},y)}),r==="vertical"&&p?[F.createElement("div",{className:`${S}-item-main`,key:"content"},n,z),F.createElement("div",{className:k(`${S}-item-extra`,D("extra")),key:"extra",style:x("extra")},p)]:[n,z,Fe(p,{key:"extra"})]);return s?F.createElement(ue,{ref:e,flex:1,style:a},R):R}),Ee=et;Ee.Meta=Ze;const tt=t=>{const{listBorderedCls:e,componentCls:i,paddingLG:n,margin:o,itemPaddingSM:p,itemPaddingLG:$,marginLG:y,borderRadiusLG:h}=t,a=E(t.calc(h).sub(t.lineWidth).equal());return{[e]:{border:`${E(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:h,[`${i}-header`]:{borderRadius:`${a} ${a} 0 0`},[`${i}-footer`]:{borderRadius:`0 0 ${a} ${a}`},[`${i}-header,${i}-footer,${i}-item`]:{paddingInline:n},[`${i}-pagination`]:{margin:`${E(o)} ${E(y)}`}},[`${e}${i}-sm`]:{[`${i}-item,${i}-header,${i}-footer`]:{padding:p}},[`${e}${i}-lg`]:{[`${i}-item,${i}-header,${i}-footer`]:{padding:$}}}},at=t=>{const{componentCls:e,screenSM:i,screenMD:n,marginLG:o,marginSM:p,margin:$}=t;return{[`@media screen and (max-width:${n}px)`]:{[e]:{[`${e}-item`]:{[`${e}-item-action`]:{marginInlineStart:o}}},[`${e}-vertical`]:{[`${e}-item`]:{[`${e}-item-extra`]:{marginInlineStart:o}}}},[`@media screen and (max-width: ${i}px)`]:{[e]:{[`${e}-item`]:{flexWrap:"wrap",[`${e}-action`]:{marginInlineStart:p}}},[`${e}-vertical`]:{[`${e}-item`]:{flexWrap:"wrap-reverse",[`${e}-item-main`]:{minWidth:t.contentWidth},[`${e}-item-extra`]:{margin:`auto auto ${E($)}`}}}}}},it=t=>{const{componentCls:e,antCls:i,controlHeight:n,minHeight:o,paddingSM:p,marginLG:$,padding:y,itemPadding:h,colorPrimary:a,itemPaddingSM:d,itemPaddingLG:s,paddingXS:r,margin:g,colorText:u,colorTextDescription:D,motionDurationSlow:x,lineWidth:A,headerBg:L,footerBg:S,emptyTextPadding:z,metaMarginBottom:q,avatarMarginRight:R,titleMarginBottom:I,descriptionFontSize:v}=t;return{[e]:Object.assign(Object.assign({},_e(t)),{position:"relative","--rc-virtual-list-scrollbar-bg":t.colorSplit,"*":{outline:"none"},[`${e}-header`]:{background:L},[`${e}-footer`]:{background:S},[`${e}-header, ${e}-footer`]:{paddingBlock:p},[`${e}-pagination`]:{marginBlockStart:$,[`${i}-pagination-options`]:{textAlign:"start"}},[`${e}-spin`]:{minHeight:o,textAlign:"center"},[`${e}-items`]:{margin:0,padding:0,listStyle:"none"},[`${e}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:h,color:u,[`${e}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${e}-item-meta-avatar`]:{marginInlineEnd:R},[`${e}-item-meta-content`]:{flex:"1 0",width:0,color:u},[`${e}-item-meta-title`]:{margin:`0 0 ${E(t.marginXXS)} 0`,color:u,fontSize:t.fontSize,lineHeight:t.lineHeight,"> a":{color:u,transition:`all ${x}`,"&:hover":{color:a}}},[`${e}-item-meta-description`]:{color:D,fontSize:v,lineHeight:t.lineHeight}},[`${e}-item-action`]:{flex:"0 0 auto",marginInlineStart:t.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${E(r)}`,color:D,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${e}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:A,height:t.calc(t.fontHeight).sub(t.calc(t.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:t.colorSplit}}},[`${e}-empty`]:{padding:`${E(y)} 0`,color:D,fontSize:t.fontSizeSM,textAlign:"center"},[`${e}-empty-text`]:{padding:z,color:t.colorTextDisabled,fontSize:t.fontSize,textAlign:"center"},[`${e}-item-no-flex`]:{display:"block"}}),[`${e}-grid ${i}-col > ${e}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:g,paddingBlock:0,borderBlockEnd:"none"},[`${e}-vertical ${e}-item`]:{alignItems:"initial",[`${e}-item-main`]:{display:"block",flex:1},[`${e}-item-extra`]:{marginInlineStart:$},[`${e}-item-meta`]:{marginBlockEnd:q,[`${e}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:I,color:u,fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}},[`${e}-item-action`]:{marginBlockStart:y,marginInlineStart:"auto","> li":{padding:`0 ${E(y)}`,"&:first-child":{paddingInlineStart:0}}}},[`${e}-split ${e}-item`]:{borderBlockEnd:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${e}-split ${e}-header`]:{borderBlockEnd:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-split${e}-empty ${e}-footer`]:{borderTop:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-loading ${e}-spin-nested-loading`]:{minHeight:n},[`${e}-split${e}-something-after-last-item ${i}-spin-container > ${e}-items > ${e}-item:last-child`]:{borderBlockEnd:`${E(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-lg ${e}-item`]:{padding:s},[`${e}-sm ${e}-item`]:{padding:d},[`${e}:not(${e}-vertical)`]:{[`${e}-item-no-flex`]:{[`${e}-item-action`]:{float:"right"}}}}},nt=t=>({contentWidth:220,itemPadding:`${E(t.paddingContentVertical)} 0`,itemPaddingSM:`${E(t.paddingContentVerticalSM)} ${E(t.paddingContentHorizontal)}`,itemPaddingLG:`${E(t.paddingContentVerticalLG)} ${E(t.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:t.padding,metaMarginBottom:t.padding,avatarMarginRight:t.padding,titleMarginBottom:t.paddingSM,descriptionFontSize:t.fontSize}),st=Me("List",t=>{const e=Te(t,{listBorderedCls:`${t.componentCls}-bordered`,minHeight:t.controlHeightLG});return[it(e),tt(e),at(e)]},nt);var ot=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};function rt(t,e){const{pagination:i=!1,prefixCls:n,bordered:o=!1,split:p=!0,className:$,rootClassName:y,style:h,children:a,itemLayout:d,loadMore:s,grid:r,dataSource:g=[],size:u,header:D,footer:x,loading:A=!1,rowKey:L,renderItem:S,locale:z}=t,q=ot(t,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),R=i&&typeof i=="object"?i:{},[I,v]=f.useState(R.defaultCurrent||1),[O,te]=f.useState(R.defaultPageSize||10),{getPrefixCls:ae,direction:ie,className:ne,style:se}=Ae("list"),{renderEmpty:U}=f.useContext(ge),l={current:1,total:0,position:"bottom"},c=C=>(_,W)=>{var le;v(_),te(W),i&&((le=i==null?void 0:i[C])===null||le===void 0||le.call(i,_,W))},b=c("onChange"),M=c("onShowSizeChange"),H=(C,_)=>{if(!S)return null;let W;return typeof L=="function"?W=L(C):L?W=C[L]:W=C.key,W||(W=`list-item-${_}`),f.createElement(f.Fragment,{key:W},S(C,_))},T=!!(s||i||x),m=ae("list",n),[V,B,P]=st(m);let j=A;typeof j=="boolean"&&(j={spinning:j});const J=!!(j!=null&&j.spinning),K=Oe(u);let X="";switch(K){case"large":X="lg";break;case"small":X="sm";break}const Q=k(m,{[`${m}-vertical`]:d==="vertical",[`${m}-${X}`]:X,[`${m}-split`]:p,[`${m}-bordered`]:o,[`${m}-loading`]:J,[`${m}-grid`]:!!r,[`${m}-something-after-last-item`]:T,[`${m}-rtl`]:ie==="rtl"},ne,$,y,B,P),w=je(l,{total:g.length,current:I,pageSize:O},i||{}),De=Math.ceil(w.total/w.pageSize);w.current=Math.min(w.current,De);const fe=i&&f.createElement("div",{className:k(`${m}-pagination`)},f.createElement(Xe,Object.assign({align:"end"},w,{onChange:b,onShowSizeChange:M})));let oe=ye(g);i&&g.length>(w.current-1)*w.pageSize&&(oe=ye(g).splice((w.current-1)*w.pageSize,w.pageSize));const we=Object.keys(r||{}).some(C=>["xs","sm","md","lg","xl","xxl"].includes(C)),he=Re(we),Z=f.useMemo(()=>{for(let C=0;C<be.length;C+=1){const _=be[C];if(he[_])return _}},[he]),Ie=f.useMemo(()=>{if(!r)return;const C=Z&&r[Z]?r[Z]:r.column;if(C)return{width:`${100/C}%`,maxWidth:`${100/C}%`}},[JSON.stringify(r),Z]);let re=J&&f.createElement("div",{style:{minHeight:53}});if(oe.length>0){const C=oe.map(H);re=r?f.createElement(xe,{gutter:r.gutter},f.Children.map(C,_=>f.createElement("div",{key:_==null?void 0:_.key,style:Ie},_))):f.createElement("ul",{className:`${m}-items`},C)}else!a&&!J&&(re=f.createElement("div",{className:`${m}-empty-text`},(z==null?void 0:z.emptyText)||(U==null?void 0:U("List"))||f.createElement(He,{componentName:"List"})));const ee=w.position,Be=f.useMemo(()=>({grid:r,itemLayout:d}),[JSON.stringify(r),d]);return V(f.createElement(pe.Provider,{value:Be},f.createElement("div",Object.assign({ref:e,style:Object.assign(Object.assign({},se),h),className:Q},q),(ee==="top"||ee==="both")&&fe,D&&f.createElement("div",{className:`${m}-header`},D),f.createElement(Ue,Object.assign({},j),re,a),x&&f.createElement("div",{className:`${m}-footer`},x),s||(ee==="bottom"||ee==="both")&&fe)))}const lt=f.forwardRef(rt),me=lt;me.Item=Ee;const ct=({url:t,token:e,role:i,eventsEmit:n})=>{const o=qe.create({baseURL:t,timeout:1e6});return o.interceptors.request.use(a=>{let d=e;return!d&&!["user/login","user/kaptcha","user/regist"].some(r=>a.url.includes(r))?(n&&n("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(a.headers.Authorization=d||"",a.headers.userName=i==="\u672A\u767B\u5F55\u7528\u6237"?"":i,a)}),o.interceptors.response.use(a=>{const d=["user/kaptcha"],s=a.data;if(d.some(D=>a.config.url&&a.config.url.includes(D))||s.size&&s.type)return s;const{success:r,errorMsg:g,errorCode:u}=s;return r?s:(n&&n("request:error_business",{errorCode:u,errorMsg:g||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:s}),!1)},a=>{var d,s,r,g,u,D,x,A,L;if(a.message==="canceled")return Promise.reject(a);if(n){let S="request:error_network",z={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:a};((d=a==null?void 0:a.response)==null?void 0:d.status)===401?(S="request:error_auth",z={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:a,redirect:"/login"}):(((r=(s=a==null?void 0:a.response)==null?void 0:s.data)==null?void 0:r.errorCode)==="30013"||((u=(g=a==null?void 0:a.response)==null?void 0:g.data)==null?void 0:u.errorCode)==="30023")&&(S="request:error_business",z={errorCode:(x=(D=a==null?void 0:a.response)==null?void 0:D.data)==null?void 0:x.errorCode,errorMsg:((L=(A=a==null?void 0:a.response)==null?void 0:A.data)==null?void 0:L.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:a}),n(S,z)}return Promise.reject(a)}),{getTableDataList:async({dbId:a,name:d,params:s})=>{try{const r=await o.get(`/directDB/queryTableData/${a}/${d}?${new URLSearchParams(s).toString()}`),{success:g,data:u}=r;if(g)return u}catch(r){return console.log("getTableDataList error:",r),!1}},updateTableData:async(a,d)=>{try{const s=await o.post(`/dataTable/dataUpdateRow/${a}`,{...d}),{success:r,data:g}=s;if(r)return g}catch(s){return console.log("updateTableData error:",s),!1}},delTableDataById:async({tableId:a,rowId:d})=>{try{const s=await o.delete(`/dataTable/dataDeleteRow/${a}/${d}`),{success:r,data:g}=s;if(r)return g}catch(s){console.log("delTableDataById error:",s)}},getFileDataList:async({fileId:a,params:d})=>{try{const s=await o.get(`/dataTable/queryTableFileData/${a}?${new URLSearchParams(d).toString()}`),{success:r,data:g}=s;return r?g:!1}catch(s){return console.log("e",s),!1}}}},dt=({drawerVisible:t,handleDrawerClose:e,rowData:i})=>{const[n,o]=G(i.data),[p,$]=G(null),[y,h]=G(""),a=s=>{h(s.value),$(s.columnId)},d=s=>{y.trim()&&(o(n.map(r=>r.columnId===s?{...r,value:y}:r)),$(null))};return Y(Ve,{title:"\u5217\u6570\u503C\u4FEE\u6539",placement:"right",width:840,onClose:()=>e("cancel"),open:t,closeIcon:!1,extra:N(Je,{size:20,color:"#888888",onClick:()=>e("cancel"),className:"cursor-pointer"}),footer:Y("div",{className:"flex justify-end items-center gap-3",style:{justifyContent:"end"},children:[N(Se,{mode:"default",label:"\u53D6\u6D88",onClick:()=>e("cancel")}),N(Se,{mode:"primary",label:"\u786E\u8BA4",onClick:async()=>{await e("confirm",n)}})]}),children:[Y(xe,{gutter:16,style:{padding:"12px 18px",background:"#fafafa",borderBottom:"1px solid #f0f0f0",fontWeight:"bold"},children:[N(ue,{span:4,children:"\u5217\u540D\u79F0"}),N(ue,{span:20,children:"\u6570\u503C"})]}),N(me,{dataSource:n,renderItem:s=>N(me.Item,{actions:[p!==s.columnId&&N(Ge,{type:"text",icon:N(Qe,{size:14}),onClick:()=>a(s)})],children:Y("div",{style:{display:"flex",width:"100%",height:"54px",lineHeight:"54px"},children:[N("div",{style:{width:"150px",marginLeft:15},children:s.columnName}),N("div",{style:{width:"550px"},children:p===s.columnId?N(We,{value:y,onChange:r=>h(r.target.value),onPressEnter:()=>d(s.columnId),onBlur:()=>d(s.columnId)}):N("div",{className:"w-full truncate",title:s.value,children:s.value})})]})})})]})},{confirm:ut}=Ye;function wt({url:t,token:e,fileId:i,role:n,dbType:o,dbId:p,tableId:$,tableName:y,CustomComponents:h,eventsEmit:a,getBtnDisabled:d}){const[s,r]=G(!1),g=Le(null),[u,D]=G(),[x,A]=G(),[L,S]=G(),[z,q]=G({app:"ready",container:"ready",content:"ready"}),{getTableDataList:R,updateTableData:I,delTableDataById:v,getFileDataList:O}=ct({url:t,token:e,role:n,eventsEmit:a});Ne(()=>{q(l=>({...l,content:"loading"})),te()},[]);const te=async()=>{try{if(o=="DirectDB"){const l=await R({dbId:p,name:y,params:{pageNo:1,pageSize:60}});l&&(l.columns=((l==null?void 0:l.columns)||[]).map(c=>({...c,id:c.id||ce(4)})),l.dataList=(l.dataList||[]).map((c,b)=>({...c,__absIndex:b})),A(l),S(l.permission),q(c=>({...c,content:"ready"})))}else{const l=await O({fileId:i,params:{pageNo:1,pageSize:60}});l&&(l.dataList=(l.dataList||[]).map((c,b)=>({...c,__absIndex:b})),l.columns=((l==null?void 0:l.columns)||[]).map(c=>({...c,id:c.id||ce(4)})),A(l),S(l.permission),q(c=>({...c,content:"ready"})))}}catch(l){console.log("[DatabaseApiError] getDataList:",l)}},ae=l=>((l==null?void 0:l.dataList)||[]).map(b=>{const H=((l==null?void 0:l.columns)||[]).filter(T=>T.physicalName!=="id").map(T=>({columnId:T.id,columnName:T.businessName,physicalName:T.physicalName,value:b[T.physicalName]||"-",type:b.dataType=="DATETIME"?"date":"paragraph"}));return o=="DataTable"&&H.push({columnId:"actions",value:"edit",label:"\u4FEE\u6539",disabled:d?d(7,L??0):!1},{columnId:"actions",value:"delete",label:"\u5220\u9664",disabled:d?d(4,L??0):!1}),{id:b.id,data:H,__absIndex:b.__absIndex}}),ie=l=>{const b=((l==null?void 0:l.columns)||[]).filter(M=>M.physicalName!=="id").map(M=>({title:o=="DirectDB"?M.physicalName:M.businessName,id:M.id,type:M.dataType=="DATETIME"?"date":"paragraph"}));return o=="DataTable"&&b.push({id:"actions",title:"\u64CD\u4F5C",type:"action"}),b},ne=async(l,c,b)=>{var M,H;switch(console.log("[DatabaseTableView] eventsEmit:",l,c,b),l){case"pagination:request_merge_data":{try{const m=(M=c==null?void 0:c.request)==null?void 0:M.pageNo,V=(H=c==null?void 0:c.request)==null?void 0:H.pageSize;if(!m||!V)return;let B;o=="DirectDB"?B=await R({dbId:p,name:y,params:{pageNo:m,pageSize:V}}):B=await O({fileId:i,params:{pageNo:m,pageSize:V}}),B&&(B.dataList=(B.dataList||[]).map((P,j)=>({...P,__absIndex:(m-1)*V+j})),B.columns=((B==null?void 0:B.columns)||[]).map(P=>({...P,id:P.id||ce(4)})),A(P=>{var Q;if(!P)return B;const j=Array.isArray(P.dataList)?P.dataList:[],J=Array.isArray(B.dataList)?B.dataList:[],K=new Map;j.forEach(w=>K.set(w.id,w)),J.forEach(w=>K.set(w.id,w));const X=Array.from(K.values());return{...P,dataList:X,total:P.total??B.total,columns:(Q=P.columns)!=null&&Q.length?P.columns:B.columns}}))}catch(m){console.log("[DatabaseApiError] pagination:request_merge_data:",m)}break}case"table_action_edit":r(!0);const T=(c.data||[]).filter(m=>m.columnId!=="actions");D({id:c.id,data:T});break;case"table_action_delete":try{ut({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 v({tableId:$,rowId:c.id})&&(Ce.success("\u8868\u6570\u636E\u5220\u9664\u6210\u529F"),b.removeItem(c.id))},onCancel(){console.log("Cancel")}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break;default:a==null||a(l,c);break}},se=async(l,c)=>{if(l=="confirm")try{const b=c.reduce((H,T)=>(H[T.physicalName]=T.value,H),{});await I($,{...b,id:u==null?void 0:u.id})&&g.current&&(Ce.success("\u6570\u636E\u4FEE\u6539\u6210\u529F"),g.current.appFn.updateItem(c,u==null?void 0:u.id))}catch(b){console.log("[TableRowApiError] updateTableData:",b)}r(!1),D(void 0)},U=ze(()=>({label:"\u6570\u636E\u5E93\u8868\u683C",defaultActiveId:"database-table",model:null,views:[{label:"\u6570\u636E\u8868\u540D\u79F0",id:"database-table",type:"table",total:(x==null?void 0:x.totalData)||999,requestPagesize:60,viewPageSize:10,allowMultiSelect:!1,columns:ie(x),viewBehavior:"pagination"}],dataSource:ae(x),eventsEmit:ne}),[x,a,o,L]);return Y(ke,{title:y,goBack:()=>{a==null||a("goBack",{})},children:[N(Ke,{ref:g,status:z,CustomComponents:{...h},...U},"table-data"),u&&N(dt,{drawerVisible:s,tableId:i,handleDrawerClose:se,rowData:u})]})}export{wt as default};
|
package/index.d.ts
CHANGED
|
@@ -26,6 +26,106 @@ export declare const ChatCompareComponent: ({ scrollOld, token, styles, senderCo
|
|
|
26
26
|
viewLimit?: number;
|
|
27
27
|
}) => JSX_2.Element;
|
|
28
28
|
|
|
29
|
+
export declare const DatabaseIdI18nContext: default_2.Context<DatabaseIdI18nValue>;
|
|
30
|
+
|
|
31
|
+
export declare function DatabaseIdI18nProvider({ locale, messages: messagesOverride, children, }: {
|
|
32
|
+
locale: DatabaseIdLocale;
|
|
33
|
+
messages?: Partial<DatabaseIdMessages>;
|
|
34
|
+
children: default_2.ReactNode;
|
|
35
|
+
}): default_2.FunctionComponentElement<default_2.ProviderProps<DatabaseIdI18nValue>>;
|
|
36
|
+
|
|
37
|
+
declare interface DatabaseIdI18nValue {
|
|
38
|
+
locale: DatabaseIdLocale;
|
|
39
|
+
messages: DatabaseIdMessages;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 数据库(按 ID 管理)模块 i18n 文案
|
|
44
|
+
* 参考 login / modelManage:提供 zh / en / ja,多数文案集中在表格列、工具栏、抽屉标题与删除确认
|
|
45
|
+
*/
|
|
46
|
+
export declare type DatabaseIdLocale = 'zh' | 'en' | 'ja';
|
|
47
|
+
|
|
48
|
+
export declare interface DatabaseIdMessages {
|
|
49
|
+
views: {
|
|
50
|
+
directDB: {
|
|
51
|
+
label: string;
|
|
52
|
+
columns: {
|
|
53
|
+
name: string;
|
|
54
|
+
cnname: string;
|
|
55
|
+
colcount: string;
|
|
56
|
+
count: string;
|
|
57
|
+
actions: string;
|
|
58
|
+
};
|
|
59
|
+
toolbar: {
|
|
60
|
+
search: string;
|
|
61
|
+
config: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
dataTable: {
|
|
65
|
+
label: string;
|
|
66
|
+
columns: {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
descriptionHelp: string;
|
|
70
|
+
count: string;
|
|
71
|
+
status: string;
|
|
72
|
+
importStatus: string;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
updatedAt: string;
|
|
75
|
+
actions: string;
|
|
76
|
+
};
|
|
77
|
+
toolbar: {
|
|
78
|
+
upload: string;
|
|
79
|
+
search: string;
|
|
80
|
+
config: string;
|
|
81
|
+
};
|
|
82
|
+
subTable: {
|
|
83
|
+
name: string;
|
|
84
|
+
count: string;
|
|
85
|
+
status: string;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
updatedAt: string;
|
|
88
|
+
actions: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
actions: {
|
|
93
|
+
view: string;
|
|
94
|
+
editConfig: string;
|
|
95
|
+
appendData: string;
|
|
96
|
+
reImport: string;
|
|
97
|
+
delete: string;
|
|
98
|
+
deleteSub: string;
|
|
99
|
+
uploadDataFile: string;
|
|
100
|
+
};
|
|
101
|
+
drawer: {
|
|
102
|
+
uploadTitle: string;
|
|
103
|
+
appendTitle: string;
|
|
104
|
+
editConfigTitle: string;
|
|
105
|
+
};
|
|
106
|
+
confirm: {
|
|
107
|
+
deleteDatabaseTitle: string;
|
|
108
|
+
deleteDatabaseContent: string;
|
|
109
|
+
deleteDataTitle: string;
|
|
110
|
+
deleteDataContent: string;
|
|
111
|
+
okTextDelete: string;
|
|
112
|
+
cancelText: string;
|
|
113
|
+
};
|
|
114
|
+
message: {
|
|
115
|
+
deleteSuccess: string;
|
|
116
|
+
deleteFailed: string;
|
|
117
|
+
deleteDataFailed: string;
|
|
118
|
+
deleteAppendSuccess: string;
|
|
119
|
+
editConfigSuccess: string;
|
|
120
|
+
editConfigFailed: string;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** 通过 ref 暴露给父组件的方法 */
|
|
125
|
+
export declare interface DatabaseViewAdopterRef {
|
|
126
|
+
getDatabaseDetail: () => Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
|
|
29
129
|
export { defaultTheme }
|
|
30
130
|
|
|
31
131
|
export declare enum DrawerType {
|
|
@@ -33,6 +133,8 @@ export declare enum DrawerType {
|
|
|
33
133
|
ALLFILELIST = "allFileList"
|
|
34
134
|
}
|
|
35
135
|
|
|
136
|
+
export declare function getDatabaseIdMessages(locale: DatabaseIdLocale, override?: Partial<DatabaseIdMessages>): DatabaseIdMessages;
|
|
137
|
+
|
|
36
138
|
export declare function getLoginMessages(locale: LoginLocale, override?: Partial<LoginMessages>): LoginMessages;
|
|
37
139
|
|
|
38
140
|
export declare function getModelManageMessages(locale: ModelManageLocale, override?: Partial<ModelManageMessages>): ModelManageMessages;
|
|
@@ -379,6 +481,8 @@ export declare interface SidebarTabConfig {
|
|
|
379
481
|
[key: string]: any;
|
|
380
482
|
}
|
|
381
483
|
|
|
484
|
+
export declare function useDatabaseIdI18n(): DatabaseIdI18nValue;
|
|
485
|
+
|
|
382
486
|
export declare function useLoginI18n(): LoginI18nValue;
|
|
383
487
|
|
|
384
488
|
export declare function useModelManageI18n(): ModelManageI18nValue;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as
|
|
1
|
+
import{D as h,a as G,L as T,g as c,u as k}from"./assets/style-IJGVxGIy.js";import{C as y}from"./assets/index-CGHHoZNS.js";import"./database.js";import{DatabaseIdI18nContext as F,DatabaseIdI18nProvider as R,getDatabaseIdMessages as W,useDatabaseIdI18n as j}from"./databaseId.js";import"./databaseTable.js";import"react/jsx-runtime";import"react";import{ModelManageI18nContext as z,ModelManageI18nProvider as A,getModelManageMessages as E,interpolateModelManage as H,useModelManageI18n as J}from"./modelManage.js";import{SensitiveI18nContext as N,SensitiveI18nProvider as O,getSensitiveMessages as Q,interpolate as U,useSensitiveI18n as V}from"./sensitive.js";import{G as Y,B as Z}from"./assets/GientechStreamReader-OCXcOLQC.js";import"./assistantConfig.js";import{f as $}from"./assets/index-DHK_n74G.js";import"./assets/index-Dp4XCzCf.js";import"react-dom";import"./assets/index-DPA1HCWQ.js";import"./assets/index-B4k3tK0f.js";import"./assets/LeftOutlined-DZMeGbKk.js";import"./assets/index-BIEKgWu0.js";import"./assets/index-CpW6Dhpp.js";import"./assets/plus-BICgMvz9.js";import"./assets/search-CD5YKija.js";import"./assets/x-DWGzNb9c.js";import"./assets/index-iOuQJ8vu.js";import"./assets/index-usBlUHOb.js";/* empty css *//* empty css */import"./assets/index-CzZQWA2P.js";import"./assets/index-97Oe7YBe.js";import"./assets/index-Dj91ulxd.js";import"./assets/triangle-alert-C4Z1AkGW.js";export{y as ChatCompareComponent,F as DatabaseIdI18nContext,R as DatabaseIdI18nProvider,h as DrawerType,Y as GientechStreamReader,G as LoginI18nContext,T as LoginI18nProvider,z as ModelManageI18nContext,A as ModelManageI18nProvider,N as SensitiveI18nContext,O as SensitiveI18nProvider,$ as defaultTheme,W as getDatabaseIdMessages,c as getLoginMessages,E as getModelManageMessages,Q as getSensitiveMessages,U as interpolate,H as interpolateModelManage,Z as registerPDFWorker,j as useDatabaseIdI18n,k as useLoginI18n,J as useModelManageI18n,V as useSensitiveI18n};
|