filecat 6.54.0 → 6.55.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/build/dist/{1472.3f96ed32e412f4871a5a.js → 1472.c5a2bdb3fe98b83c934c.js} +1 -1
- package/build/dist/3402.a72b6d7e2a0f49a66105.js +1 -0
- package/build/dist/676.39a5ffb9b489247e47b6.js +1 -0
- package/build/dist/{678.be7b63312ca9e0300634.js → 678.96f35e8b6ed598aa5fd7.js} +1 -1
- package/build/dist/index.html +1 -1
- package/build/dist/{main.b69cac9ec636dcac1c3e.js → main.8f8db2dd63123892b04d.js} +2 -2
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/3402.62335cc49fe962eaf134.js +0 -1
- package/build/dist/676.b1772b6eb675cd8ffdaf.js +0 -1
- /package/build/dist/{main.b69cac9ec636dcac1c3e.js.LICENSE.txt → main.8f8db2dd63123892b04d.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3402],{72693(e,n,t){t.d(n,{w:()=>u});var s=t(96540),r=t(34899),a=t(14944),c=t(92275),o=t(34843),d=t(82893),l=t(85997),i=t(74848);function u(){const[e,n]=(0,o.fp)(d.AG.prompt_card),{t}=(0,r.Bd)(),u=(0,s.useRef)([]),f=(0,s.useRef)(!1),m=(0,s.useCallback)(()=>{if(f.current)return;if(0===u.current.length)return f.current=!1,void n({open:!1});f.current=!0;const e=u.current.shift();e?n({open:!0,title:t("命令确认"),cancel:()=>{a.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),n({open:!1}),f.current=!1,m()},context_div:(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),(0,i.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,i.jsx)(l.$n,{text:t("拒绝"),color:"var(--red)",clickFun:()=>{a.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),n({open:!1}),f.current=!1,m()}}),(0,i.jsx)(l.$n,{text:t("允许"),clickFun:()=>{a.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!0}),n({open:!1}),f.current=!1,m()}})]})]})}):f.current=!1},[t]),h=(0,s.useCallback)(e=>{u.current.push(e),m()},[m]);(0,s.useEffect)(()=>(a.ws.addMsg(c.HK.ai_confirm_cmd,e=>{const t=e.context||{};if(t.dismiss&&t.askId)return u.current=u.current.filter(e=>e.askId!==t.askId),void(f.current&&(f.current=!1,n({open:!1}),m()));t.askId&&t.cmd&&h({askId:t.askId,cmd:t.cmd})}),()=>{a.ws.removeMsg(c.HK.ai_confirm_cmd)}),[h]),(0,s.useEffect)(()=>()=>{u.current=[],f.current=!1},[])}},63402(e,n,t){t.r(n),t.d(n,{default:()=>h});var s=t(96540),r=t(97856),a=t(92275),c=t(14944),o=t(34843),d=t(82893),l=t(64405),i=t(40505),u=t(72693),f=t(74848);const m=s.lazy(()=>Promise.all([t.e(2543),t.e(5614)]).then(t.bind(t,85614)));function h(e){const[n,t]=(0,s.useState)(null),[h,p]=(0,o.fp)(d.AG.fileShellShow),[w,k]=(0,o.fp)(d.AG.file_shell_hidden),[_,g]=(0,o.fp)(d.AG.user_base_info),x=_.user_data.theme?.includes("dark")?"#FFFFFF":"#000000";(0,u.w)();const v=()=>{n?.dispose(),t(null)};(0,s.useEffect)(()=>()=>{v()},[]),(0,s.useEffect)(()=>{h.show?n?h.cmd&&c.ws.sendData(a.HK.shell_send,h.cmd):(async()=>{const e=new r.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:x,cursor:x,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let n;const s=n=>{e.write(n)};n=t=>{e.clear(),e.write(t),n=s},await c.ws.addMsg(a.HK.shell_getting,e=>{n(e.context)}),await c.ws.addMsg(a.HK.shell_copy,n=>{n.context&&(0,i.lW)(n.context),e.focus()}),e.onData(async e=>{const n=new a.hf(a.HK.shell_send);n.context=e,await c.ws.send(n)}),t(e)})():v()},[h]);return(0,f.jsx)(m,{show:h.show,file_shell_hidden:w,terminal:n,init:(e,t)=>{n.writeln("[38;2;29;153;243mopen shell...[0m ");const s=new a.hf(a.HK.shell_open),r=new l.n;r.init_path=h.path,r.rows=e,r.cols=t,r.http_token=localStorage.getItem("token"),s.context=r,c.ws.send(s),h.cmd&&c.ws.sendData(a.HK.shell_send,h.cmd)}})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[676,4091],{77481(e,t,s){s.d(t,{S:()=>a,X:()=>i});var n=s(96540),r=s(74848);function i(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 a(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),i=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(24522)),a=s(34843),l=s(82893),c=s(78247),o=s(74848);function u(e){const t=(0,n.useRef)(null),[s,u]=(0,a.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??i.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:()=>w});var n=s(96540),r=s(57952),i=s(85997),a=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),_=s(23496),f=s(62042),x=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:i="",onTick:a,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),a?.(t),p.current&&(d.current=requestAnimationFrame(e))};e()},[a,h]);return(0,n.useEffect)(()=>{u.current=performance.now(),o(0),a?.(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:[i,b(c,r)]})}var S=s(87361);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)(i.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function w(){const e=(0,l.Zp)(),{t}=(0,x.Bd)(),{initUserInfo:s}=(0,n.useContext)(g.F),[b]=(0,u.fp)(d.AG.sqlite_query_context),[w]=(0,u.fp)(d.AG.user_base_info),[,C]=(0,u.fp)(d.AG.prompt_card),k=(0,n.useMemo)(()=>b?.path??"",[b?.path]),N=(0,n.useMemo)(()=>b?.path?`${b?.name||"数据库"} | ${b.path}`:"未选择数据库",[b?.name,b?.path]),$=97,[A,K]=(0,n.useState)(""),[E,F]=(0,n.useState)("table"),[L,M]=(0,n.useState)(!1),[O,P]=(0,n.useState)(""),[Q,R]=(0,n.useState)(null),[J,G]=(0,n.useState)(!1),[T,I]=(0,n.useState)(0),[Z,B]=(0,n.useState)(!1),[V,X]=(0,n.useState)([]),[z,D]=(0,n.useState)(-1);(0,n.useEffect)(()=>{const e=w?.user_data?.sql_preset_list;e&&e.length?X([...e]):X([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[w?.user_data?.sql_preset_list]);const H=async e=>{const t=e.map((e,t)=>({...e,index:t})),n=await a.wm.post(_.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return n?.code===j.m.Success&&(await s(),X(t),!0)},U=async(e,s)=>{const n=[...V,{note:s||t("SQL 预设"),sql:e}];await H(n)&&(C({open:!1}),(0,f.SK)(t("创建成功")),D(n.length-1))},W=(e,t)=>{if(!e)return"";for(const s of e.split("\n")){const e=s.indexOf("=");if(!(e<0)&&s.slice(0,e).trim()===t)return s.slice(e+1).trim()}return""},[Y,ee]=(0,n.useState)(""),[te,se]=(0,n.useState)("");(0,n.useEffect)(()=>{h.xK.set_value_temp(A,$)},[A]),(0,n.useEffect)(()=>{K(""),P(""),R(null),F("table"),G(!1),B(!1),I(0),ee(""),se(""),h.xK.set_value_temp("",$),k||P("请先从文件右键打开一个数据库")},[k,b?.open]);const ne=async()=>{const e=(h.xK.get_editor_value($)??A).trim();if(!k)return P("请先从文件右键打开一个数据库"),void R(null);if(!e)return P("请输入 SQL 语句"),void R(null);M(!0),P(""),B(!0),I(e=>e+1),G(!0);try{const s=(t=e,Y?t.split(Y).join(te):t),n=await a.$M.post("sqlite/query",{path:k,sql:s});R(n.data),F("table")}catch(e){P(e?.message??`${e}`),R(null)}finally{G(!1),M(!1)}var t},re=Q?.columns?.length?Q.columns:Object.keys(Q?.rows?.[0]??{}),ie=(Q?.rows??[]).map(e=>re.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)(i.rA,{icon:"arrow_back",title:"返回",onClick:()=>e(-1)},"back"),(0,v.jsx)(i.rA,{icon:"play_arrow",title:"执行",onClick:ne},"run"),(0,v.jsx)(i.rA,{icon:"table_chart",title:"表格视图",onClick:()=>F("table")},"table"),(0,v.jsx)(i.rA,{icon:"data_object",title:"原 JSON",onClick:()=>F("json")},"json"),(0,v.jsx)(i.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{e(S.o.sql_preset_setting_page)}},"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:[Y&&(0,v.jsx)(m.Sm,{placeholder:`${t("替换")}: ${Y}`,value:te,handleInputChange:se,width:"12rem"}),V.length>0&&(0,v.jsx)(m.l6,{width:"16rem",tip:t("SQL预设"),value:z,onChange:e=>{const t=V[e];t&&(D(e),(e=>{h.xK.set_value_temp(e,$);const t=h.xK.get_editor($);t&&t.setValue(e,-1),K(e)})(t.sql),ee(W(t.env??"","find")),se(""),P(""))},options:V.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,v.jsx)(i.C3,{text:t(z>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(h.xK.get_editor_value($)??A).trim();if(!e)return void P(t("请输入 SQL 语句"));const s=[...V];if(z>=0&&s[z]){s[z].sql=e,s[z].note||(s[z].note=t("SQL 预设"));await H(s)&&(0,f.SK)(t("更新成功"))}else C({open:!0,title:t("创建新预选项"),context_div:(0,v.jsx)(q,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>U(e,t)}),cancel:()=>C({open:!1})})}})]}),rightBottomCom:(0,v.jsxs)("div",{className:"db-query-page__actions",children:[(0,v.jsx)(i.C3,{text:L?"查询中...":"执行查询",clickFun:ne}),(0,v.jsx)(i.C3,{text:"清空",clickFun:()=>{h.xK.set_value_temp("",$);const e=h.xK.get_editor($);e&&e.setValue("",-1),K("")}}),(0,v.jsx)(i.C3,{text:"table"===E?"表格视图":"切换到表格",clickFun:()=>F("table")}),(0,v.jsx)(i.C3,{text:"json"===E?"原 JSON":"切换到 JSON",clickFun:()=>F("json")})]}),children:[(0,v.jsx)("div",{className:"db-query-page__editor",children:(0,v.jsx)(p.default,{name:"sqlite.sql",editor_id:$,model:"ace/mode/sql",on_change:()=>{const e=h.xK.get_editor_value($)??"";K(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),O&&(0,v.jsx)("div",{className:"db-query-page__error",children:O})]}),(0,v.jsxs)(o.Zp,{title:"查询结果",titleCom:(0,v.jsxs)("span",{className:"db-query-page__result-meta",children:[Q?`${Q.row_count} 行`:"暂无结果",Z&&(0,v.jsx)("span",{className:"db-query-page__elapsed",children:(0,v.jsx)(y,{running:J,resetKey:T,prefix:`${t("耗时")}: `,format:"auto"})})]}),children:[Q&&"table"===E&&(0,v.jsx)(c.X,{headers:re,rows:ie}),Q&&"json"===E&&(0,v.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(Q.rows,null,2)}),!Q&&!O&&(0,v.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!Q&&O&&(0,v.jsx)("div",{className:"db-query-page__hint",children:O})]})]})]})}}}]);
|
|
File without changes
|