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