filecat 6.52.0 → 6.53.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "6.52.0",
3
+ "version": "6.53.0",
4
4
  "description": "File browser and server manager",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091,4488],{77481(e,t,s){s.d(t,{S:()=>r,X:()=>l});var n=s(96540),i=s(74848);function l(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((e,t)=>(0,i.jsx)("th",{children:e},t))})}),(0,i.jsx)("tbody",{children:t.map((t,s)=>(0,i.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,i.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function r(e){return(0,i.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,i.jsx)("div",{children:e},t))})}},84091(e,t,s){s.r(t),s.d(t,{default:()=>d});var n=s(96540),i=s(80952),l=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(1234),s(47507),s(87268),s(24522)),r=s(34843),a=s(82893),c=s(78247),o=s(74848);function d(e){const t=(0,n.useRef)(null),[s,d]=(0,r.fp)(a.AG.user_base_info),u=s.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,n.useEffect)(()=>{const s=i.edit(t.current,{value:c.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${u}`,mode:e.model??l.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return s.setOptions({}),s.container.addEventListener("wheel",function(e){e.preventDefault()}),s.focus(),s.on("change",function(t){e.on_change&&e.on_change()}),t.current=s,s.formatCode=()=>{const e=i.require("ace/ext/beautify"),s=t.current;s&&e.beautify(s.session)},c.xK.set_editor_temp(s,e.editor_id),()=>{c.xK.delete_editor_temp(e.editor_id),s.destroy()}},[]),(0,o.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}i.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${i.version}/src-min-noconflict/`),i.config.set("modePath",`https://gcore.jsdelivr.net/npm/ace-builds@${i.version}/src-min-noconflict/`),i.config.set("themePath",`https://gcore.jsdelivr.net/npm/ace-builds@${i.version}/src-min-noconflict/`),i.config.set("workerPath",`https://gcore.jsdelivr.net/npm/ace-builds@${i.version}/src-min-noconflict/`),i.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${i.version}/src-min-noconflict/`)},84488(e,t,s){s.r(t),s.d(t,{default:()=>y});var n=s(96540),i=s(57952),l=s(85997),r=s(14284),a=s(76213),c=s(77481),o=s(70447),d=s(34843),u=s(82893),h=s(84091),p=s(78247),_=s(61443),x=s(23496),m=s(62042),j=s(34899),f=s(53459),g=s(7523),v=s(74848);function b(e){const[t,s]=(0,n.useState)("");return(0,v.jsxs)("div",{className:"db-query-preset-input",children:[(0,v.jsx)(_.Sm,{placeholder:e.placeholder,value:t,handleInputChange:s}),(0,v.jsx)("div",{className:"db-query-preset-input__actions",children:(0,v.jsx)(l.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function y(){const e=(0,a.Zp)(),{t}=(0,j.Bd)(),{initUserInfo:s}=(0,n.useContext)(g.F),[y]=(0,d.fp)(u.AG.sqlite_query_context),[q,C]=(0,d.fp)(u.AG.user_base_info),[S,w]=(0,d.fp)(u.AG.prompt_card),k=(0,n.useMemo)(()=>y?.path??"",[y?.path]),N=(0,n.useMemo)(()=>y?.path?`${y?.name||"数据库"} | ${y.path}`:"未选择数据库",[y?.name,y?.path]),A=97,[K,L]=(0,n.useState)(""),[$,F]=(0,n.useState)("table"),[E,M]=(0,n.useState)(!1),[P,Q]=(0,n.useState)(""),[O,J]=(0,n.useState)(null),[G,I]=(0,n.useState)([]),[R,T]=(0,n.useState)(-1);(0,n.useEffect)(()=>{const e=q?.user_data?.sql_preset_list;e&&e.length?I([...e]):I([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[q?.user_data?.sql_preset_list]);const Z=async e=>{const t=e.map((e,t)=>({...e,index:t})),n=await r.wm.post(x.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return n?.code===f.m.Success&&(await s(),I(t),!0)},B=async(e,s)=>{const n=[...G,{note:s||t("SQL 预设"),sql:e}];await Z(n)&&(w({open:!1}),(0,m.SK)(t("创建成功")),T(n.length-1))};(0,n.useEffect)(()=>{p.xK.set_value_temp(K,A)},[K]),(0,n.useEffect)(()=>{L(""),Q(""),J(null),F("table"),p.xK.set_value_temp("",A),k||Q("请先从文件右键打开一个数据库")},[k,y?.open]);const V=async()=>{const e=(p.xK.get_editor_value(A)??K).trim();if(!k)return Q("请先从文件右键打开一个数据库"),void J(null);if(!e)return Q("请输入 SQL 语句"),void J(null);M(!0),Q("");try{const t=await r.$M.post("sqlite/query",{path:k,sql:e});J(t.data),F("table")}catch(e){Q(e?.message??`${e}`),J(null)}finally{M(!1)}},X=O?.columns?.length?O.columns:Object.keys(O?.rows?.[0]??{}),z=(O?.rows??[]).map(e=>X.map(t=>{return null==(s=e[t])?"":"object"==typeof s?JSON.stringify(s):`${s}`;var s}));return(0,v.jsxs)("div",{className:"db-query-page",children:[(0,v.jsx)(i.A,{ignore_tags:!0,left_children:[(0,v.jsx)(l.rA,{icon:"arrow_back",title:"返回",onClick:()=>e(-1)},"back"),(0,v.jsx)(l.rA,{icon:"play_arrow",title:"执行",onClick:V},"run"),(0,v.jsx)(l.rA,{icon:"table_chart",title:"表格视图",onClick:()=>F("table")},"table"),(0,v.jsx)(l.rA,{icon:"data_object",title:"原 JSON",onClick:()=>F("json")},"json"),(0,v.jsx)(l.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{w({open:!0,title:t("SQL 预设设置"),context_div:(0,v.jsxs)("div",{className:"db-query-preset-setting",children:[(0,v.jsxs)("div",{className:"db-query-preset-setting__toolbar",children:[(0,v.jsx)(l.rA,{icon:"add",title:t("添加预设"),onClick:()=>{I(e=>[...e,{note:"",sql:""}]),T(-1)}}),(0,v.jsx)(l.rA,{icon:"save",title:t("保存"),onClick:async()=>{await Z(G)&&(0,m.SK)(t("保存成功"))}})]}),(0,v.jsx)("div",{className:"db-query-preset-setting__list",children:G.map((e,s)=>(0,v.jsxs)("div",{className:"db-query-preset-setting__row",children:[(0,v.jsx)("span",{className:"db-query-preset-setting__index",children:s+1}),(0,v.jsx)(_.Sm,{placeholder:t("备注"),value:e.note,handleInputChange:t=>{e.note=t,I([...G])}}),(0,v.jsx)("textarea",{className:"db-query-preset-setting__sql",placeholder:t("SQL代码"),value:e.sql,onChange:t=>{e.sql=t.target.value,I([...G])}}),(0,v.jsx)(l.rA,{icon:"delete",title:t("删除"),onClick:()=>{const e=G.filter((e,t)=>t!==s);I(e),R===s&&T(-1)}})]},s))}),(0,v.jsx)("div",{className:"db-query-preset-setting__footer",children:(0,v.jsx)(l.C3,{text:t("取消"),clickFun:()=>w({open:!1})})})]}),cancel:()=>w({open:!1})})}},"preset-setting")],children:(0,v.jsx)(o.xP,{context:N,tip_context:"点击复制数据库信息"})}),(0,v.jsxs)("div",{className:"db-query-page__content",children:[(0,v.jsxs)(o.Zp,{title:"SQL 查询",titleCom:(0,v.jsxs)("div",{className:"db-query-page__preset-bar",children:[G.length>0&&(0,v.jsx)(_.l6,{width:"16rem",tip:t("SQL预设"),value:R,onChange:e=>{const t=G[e];t&&(T(e),(e=>{p.xK.set_value_temp(e,A);const t=p.xK.get_editor(A);t&&t.setValue(e,-1),L(e)})(t.sql),Q(""))},options:G.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,v.jsx)(l.C3,{text:t(R>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(p.xK.get_editor_value(A)??K).trim();if(!e)return void Q(t("请输入 SQL 语句"));const s=[...G];if(R>=0&&s[R]){s[R].sql=e,s[R].note||(s[R].note=t("SQL 预设"));await Z(s)&&(0,m.SK)(t("更新成功"))}else w({open:!0,title:t("创建新预选项"),context_div:(0,v.jsx)(b,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>B(e,t)}),cancel:()=>w({open:!1})})}})]}),rightBottomCom:(0,v.jsxs)("div",{className:"db-query-page__actions",children:[(0,v.jsx)(l.C3,{text:E?"查询中...":"执行查询",clickFun:V}),(0,v.jsx)(l.C3,{text:"清空",clickFun:()=>{p.xK.set_value_temp("",A);const e=p.xK.get_editor(A);e&&e.setValue("",-1),L("")}}),(0,v.jsx)(l.C3,{text:"table"===$?"表格视图":"切换到表格",clickFun:()=>F("table")}),(0,v.jsx)(l.C3,{text:"json"===$?"原 JSON":"切换到 JSON",clickFun:()=>F("json")})]}),children:[(0,v.jsx)("div",{className:"db-query-page__editor",children:(0,v.jsx)(h.default,{name:"sqlite.sql",editor_id:A,model:"ace/mode/sql",on_change:()=>{const e=p.xK.get_editor_value(A)??"";L(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),P&&(0,v.jsx)("div",{className:"db-query-page__error",children:P})]}),(0,v.jsxs)(o.Zp,{title:"查询结果",titleCom:(0,v.jsx)("span",{children:O?`${O.row_count} 行`:"暂无结果"}),children:[O&&"table"===$&&(0,v.jsx)(c.X,{headers:X,rows:z}),O&&"json"===$&&(0,v.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(O.rows,null,2)}),!O&&!P&&(0,v.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!O&&P&&(0,v.jsx)("div",{className:"db-query-page__hint",children:P})]})]})]})}}}]);