From 0e45669f15219f8fefb7c3c41e3967cf30cf47a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E4=BF=8A=E5=AD=A6?= <2506370693@qq.com>
Date: Mon, 8 Apr 2024 09:11:10 +0800
Subject: [PATCH] push
---
dist/.vite/manifest.json | 6 +++++-
dist/.vite/ssr-manifest.json | 3 +++
dist/assets/GradeLog.sql | 2 +-
dist/index.html | 3 ++-
dist/js/copy-text-to-clipboard-SBA1EQaE.js | 1 +
dist/js/main-PzViLr1B.js | 8 --------
dist/js/main-mjhR0BsP.js | 8 ++++++++
7 files changed, 20 insertions(+), 11 deletions(-)
create mode 100644 dist/js/copy-text-to-clipboard-SBA1EQaE.js
delete mode 100644 dist/js/main-PzViLr1B.js
create mode 100644 dist/js/main-mjhR0BsP.js
diff --git a/dist/.vite/manifest.json b/dist/.vite/manifest.json
index a2159f9..4cb85ec 100644
--- a/dist/.vite/manifest.json
+++ b/dist/.vite/manifest.json
@@ -35,6 +35,9 @@
"_clsx-2Jv0kmJG.js": {
"file": "js/clsx-2Jv0kmJG.js"
},
+ "_copy-text-to-clipboard-SBA1EQaE.js": {
+ "file": "js/copy-text-to-clipboard-SBA1EQaE.js"
+ },
"_dayjs-w40geAFS.js": {
"file": "js/dayjs-w40geAFS.js"
},
@@ -94,13 +97,14 @@
"css": [
"css/main-uN13F96r.css"
],
- "file": "js/main-PzViLr1B.js",
+ "file": "js/main-mjhR0BsP.js",
"imports": [
"_react-ejZHSj7z.js",
"_@mui-_A7eRbnw.js",
"_react-router-y82kxMFL.js",
"_react-router-dom-v3GnXs1D.js",
"_ahooks-LOzqvy8i.js",
+ "_copy-text-to-clipboard-SBA1EQaE.js",
"_object-assign-4_VUvG2Z.js",
"_@emotion-tNa4IMmz.js",
"_hoist-non-react-statics-o0ngdJFr.js",
diff --git a/dist/.vite/ssr-manifest.json b/dist/.vite/ssr-manifest.json
index 918fc2d..a863139 100644
--- a/dist/.vite/ssr-manifest.json
+++ b/dist/.vite/ssr-manifest.json
@@ -3800,6 +3800,9 @@
],
"App.tsx": [
],
+ "D:/apipost/ApiPost7/resources/app/node_modules/copy-text-to-clipboard/index.js": [
+ "./js/copy-text-to-clipboard-SBA1EQaE.js"
+ ],
"Route/index.tsx": [
],
"components/AppBar/_index.module.scss": [
diff --git a/dist/assets/GradeLog.sql b/dist/assets/GradeLog.sql
index e8e9e8e..7e1d76f 100644
--- a/dist/assets/GradeLog.sql
+++ b/dist/assets/GradeLog.sql
@@ -5,7 +5,7 @@ course_id INT REFERENCES Course(course_id),
score_old INT,
score_new INT,
log_time TIMESTAMP UNIQUE NOT NULL,
- PRIMARY KEY (student_id,course_id),
+ PRIMARY KEY (student_id,course_id,log_time),
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (course_id) REFERENCES Course(course_id)
);
diff --git a/dist/index.html b/dist/index.html
index 3f9ce01..4326cad 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -95,7 +95,7 @@
-
+
@@ -110,6 +110,7 @@
+
diff --git a/dist/js/copy-text-to-clipboard-SBA1EQaE.js b/dist/js/copy-text-to-clipboard-SBA1EQaE.js
new file mode 100644
index 0000000..e870f1b
--- /dev/null
+++ b/dist/js/copy-text-to-clipboard-SBA1EQaE.js
@@ -0,0 +1 @@
+function l(t,{target:a=document.body}={}){if(typeof t!="string")throw new TypeError(`Expected parameter \`text\` to be a \`string\`, got \`${typeof t}\`.`);const e=document.createElement("textarea"),n=document.activeElement;e.value=t,e.setAttribute("readonly",""),e.style.contain="strict",e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="12pt";const o=document.getSelection(),c=o.rangeCount>0&&o.getRangeAt(0);a.append(e),e.select(),e.selectionStart=0,e.selectionEnd=t.length;let s=!1;try{s=document.execCommand("copy")}catch{}return e.remove(),c&&(o.removeAllRanges(),o.addRange(c)),n&&n.focus(),s}export{l as c};
diff --git a/dist/js/main-PzViLr1B.js b/dist/js/main-PzViLr1B.js
deleted file mode 100644
index 7d58c45..0000000
--- a/dist/js/main-PzViLr1B.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import{j as e}from"./react-ejZHSj7z.js";import{B as Xe,C as ye,S as Ye,L as bt,D as Tt,a as Et,d as fe,b as Ze,c as Rt,P as A,e as _t,A as Ae,f as Ie,T as Be,g as Fe,h as qe,i as ie,F as et,j as $t,k as N,l as tt,m as Ct,n as kt,o as Lt,p as Ue,q as Qe,r as Dt,s as Nt,t as wt,u as Pt,v as Ot,I as Mt,w as At,M as me,x as ge,y as It,z as Bt,E as Ft,G as qt,H as Ut,J as Qt,K as Ht,N as zt,O as Wt,Q as Kt,R as Vt,U as Gt,V as Jt,W as Xt,X as Yt}from"./@mui-_A7eRbnw.js";import{d as st,O as Zt,e as es,f as he}from"./react-router-y82kxMFL.js";import{N as ts,H as ss}from"./react-router-dom-v3GnXs1D.js";import{u as nt,a as oe,b as ae,c as M,d as ns,e as os,f as as,g as rs}from"./ahooks-LOzqvy8i.js";import"./object-assign-4_VUvG2Z.js";import"./@emotion-tNa4IMmz.js";import"./hoist-non-react-statics-o0ngdJFr.js";import"./@babel-moqvDIRK.js";import"./stylis-UTZzoVRx.js";import"./clsx-2Jv0kmJG.js";import"./@remix-run-Tfa50bkj.js";import"./tslib-g6pQwBLH.js";import"./lodash-liWoq_f8.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))d(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&d(l)}).observe(document,{childList:!0,subtree:!0});function c(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function d(n){if(n.ep)return;n.ep=!0;const a=c(n);fetch(n.href,a)}})();const cs="modulepreload",is=function(t,o){return new URL(t,o).href},He={},ls=function(o,c,d){let n=Promise.resolve();if(c&&c.length>0){const a=document.getElementsByTagName("link");n=Promise.all(c.map(l=>{if(l=is(l,d),l in He)return;He[l]=!0;const h=l.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(!!d)for(let S=a.length-1;S>=0;S--){const j=a[S];if(j.href===l&&(!h||j.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${m}`))return;const x=document.createElement("link");if(x.rel=h?"stylesheet":cs,h||(x.as="script",x.crossOrigin=""),x.href=l,document.head.appendChild(x),h)return new Promise((S,j)=>{x.addEventListener("load",S),x.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${l}`)))})}))}return n.then(()=>o()).catch(a=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a})},ds="_AppBar_n6byb_1",us="_menuIcon_n6byb_11",ps="_Avatar_n6byb_19",ms="_open_n6byb_27",hs="_Popover_n6byb_39",xs="_DialogActions_n6byb_57",z={AppBar:ds,menuIcon:us,Avatar:ps,open:ms,Popover:hs,DialogActions:xs};var ot=(t=>(t.SET_TITLE="SET_TITLE",t))(ot||{}),at=(t=>(t.title="title",t))(at||{});const fs={title:""},gs=(t=fs,o)=>{const{type:c,payload:d={}}=o;switch(c){case"SET_TITLE":return{...t,...d};default:return t}},ys=ReactRedux.useSelector,js="_NavLink_1kxee_1",vs="_CollapseClick_1kxee_8",Ss="_ArrowDownIcon_1kxee_11",bs="_overview_1kxee_15",Ts="_ListItemButton_1kxee_20",W={NavLink:js,CollapseClick:vs,ArrowDownIcon:Ss,overview:bs,ListItemButton:Ts};var je=(t=>(t.SET="SET",t))(je||{}),Y=(t=>(t.config="config",t.index="index",t))(Y||{});const Es={config:[],index:!1},Rs=(t=Es,o)=>{const{type:c,payload:d={}}=o;switch(c){case"SET":return{...t,...d};default:return t}},rt=ReactRedux.useSelector,ct=({className:t,...o})=>e.jsx(Rt,{className:classNames(t,W.ListItemButton),...o}),it=t=>{const{text:o="",path:c="",setOpen:d,...n}=t,[a,l]=React.useState(!1),[h,m]=React.useState(!0),v=ReactRedux.useDispatch();return e.jsx(ct,{selected:a,disableGutters:!0,onClick:x=>{const{target:S}=x;if(HTMLDivElement.prototype.isPrototypeOf(S)&&S instanceof HTMLDivElement&&Object.prototype.toString.call(S)==="[object HTMLDivElement]"&&S.constructor===HTMLDivElement&&typeof S=="object"){const{children:j,childNodes:C}=S,f=j.item(0)??j[0]??C[0]??C.values().next().value??document.createElement("a");HTMLAnchorElement.prototype.isPrototypeOf(f)&&f instanceof HTMLAnchorElement&&Object.prototype.toString.call(f)==="[object HTMLAnchorElement]"&&f.constructor===HTMLAnchorElement&&typeof f=="object"&&f.click()}},...n,children:e.jsx(ts,{to:c,className:({isActive:x})=>ReactDOM.unstable_batchedUpdates(()=>(l(x),x&&h&&d?.(),m(!1),W.NavLink)),onClick:()=>{v({type:ot.SET_TITLE,payload:{title:o}}),document.title=o},children:o})})},_s=({item:t})=>{const{children:o,id:c,path:d=""}=t,[n,a]=React.useState(!1);return e.jsxs(React.StrictMode,{children:[e.jsxs(ct,{onClick:a.bind(null,!n),className:classNames(W.CollapseClick,{[W.CollapseClickActive??""]:n}),children:[e.jsx(Et,{primary:c}),e.jsx(fe,{className:classNames({[W.ArrowDownIcon??""]:n})})]}),e.jsx(Ze,{in:n,children:e.jsx("ul",{children:o?.map((l,h)=>e.jsx("li",{children:e.jsx(it,{text:l.id??"",path:ht(d,l.path??""),setOpen:a.bind(null,!0)})},h))})})]})};function ve(){const t=ReactRedux.useDispatch(),{data:o,loading:c}=nt(()=>axios.get("assets/config.json").then(n=>{const{data:a}=n;return t({type:je.SET,payload:{config:a}}),a}).catch(console.error),ft);if(c||!o)return e.jsx(Xe,{open:!0,children:e.jsx(ye,{})});const d=o.map(n=>({id:n.path,path:n.path,children:n.children.map(a=>({path:a,id:a}))}));return e.jsx(React.StrictMode,{children:e.jsx(Ye,{injectFirst:!0,children:[...gn,...d].map((n,a)=>{const{children:l,id:h="",path:m=""}=n;return e.jsxs(React.StrictMode,{children:[e.jsx(bt,{children:l?e.jsx(_s,{item:n}):e.jsx(it,{text:h,path:ht(m),className:W.overview??""})},a),e.jsx(Tt,{})]})})})})}const $s="_Paper_p9qzm_1",Cs={Paper:$s},{queueMicrotask:ks,setTimeout:Ls,Promise:ze,requestIdleCallback:Ds,requestAnimationFrame:Ns,console:We,MessageChannel:ws}=window??self??globalThis??global??void 0,re=(t=()=>{})=>{const o=(c=()=>{})=>Ds?.(()=>Ls?.(()=>Ns?.(()=>ks?.(()=>ze?.resolve?.()?.then?.(()=>{const{port1:d,port2:n}=new ws;n.onmessage=()=>c?.(),d?.postMessage?.(null)}).catch?.(We?.error)))));return new ze(c=>o?.(c))?.then?.(()=>o?.(t)).catch?.(We?.error)},{addEventListener:Ps,queueMicrotask:Os,setTimeout:Ms,Promise:Ke,requestIdleCallback:As,requestAnimationFrame:Is,console:Ve,MessageChannel:Bs}=window??self??globalThis??global??void 0,Fs=(t=()=>{})=>{const o=(c=()=>{})=>As?.(()=>Ms?.(()=>Is?.(()=>Os?.(()=>Ke?.resolve?.()?.then?.(()=>{const{port1:d,port2:n}=new Bs;n.onmessage=()=>c?.(),d?.postMessage?.(null)}).catch?.(Ve?.error)))));return Ps("load",()=>new Ke(c=>o?.(c))?.then?.(()=>o?.(t)).catch?.(Ve?.error))},Ge={elevation:24,className:Cs.Paper??""},le="WebSQL",{addEventListener:Bn,document:qs,navigator:Fn,Object:qn,console:Un}=window??self??globalThis??global??void 0;Fs(()=>qs.title=le);function Us(){return e.jsxs(React.StrictMode,{children:[e.jsx(A,{...Ge,children:le}),e.jsx(A,{...Ge,children:e.jsx(ve,{})})]})}const Qs=Object.freeze(Object.defineProperty({__proto__:null,default:Us,documentTitle:le},Symbol.toStringTag,{value:"Module"})),Hs="_Paper_1ieip_2",zs="_Input_1ieip_22",Ws="_sqlInput_1ieip_41",Ks="_AccordionDetails_1ieip_48",Vs="_last_1ieip_57",Gs="_fullWidth_1ieip_65",Js="_aLink_1ieip_71",Xs="_Skeleton_1ieip_79",Ys="_dialog_1ieip_84",D={Paper:Hs,Input:zs,sqlInput:Ws,AccordionDetails:Ks,last:Vs,fullWidth:Gs,aLink:Js,Skeleton:Xs,dialog:Ys};var w=(t=>(t.SnackbarAlert="SnackbarAlert",t.OPENTRUE="OPENTRUE",t.OPENFALSE="OPENFALSE",t))(w||{}),E=(t=>(t.alertText="alertText",t.open="open",t.severity="severity",t))(E||{}),I=(t=>(t.error="error",t.info="info",t.success="success",t.warning="warning",t))(I||{});const Zs={alertText:"",open:!1,severity:"success"},en=(t=Zs,o)=>{const{type:c,payload:d={}}=o,n=a=>({...t,...d,open:a});switch(c){case"OPENFALSE":return n(!1);case"OPENTRUE":return n(!0);default:return t}},lt=ReactRedux.useSelector,{entries:X,values:tn,keys:xe}=Object,sn=window??global??globalThis??self??void 0,dt="table",nn="1.0",on=dt,an=2*1024*1024,Z=sn.openDatabase(dt,nn,on,an,t=>{}),rn="未选择",ut=t=>{const{i:o,...c}=t,{foreignTable:d,foreignKey:n,id:a}=o,[l,h]=os();return React.useEffect(()=>{d&&n&&Z.transaction(m=>{m.executeSql(`SELECT * FROM ${d}`,[],function(v,x){h(x.rows)})},m=>{},()=>{})},[d,n]),e.jsxs(Ot,{fullWidth:!0,children:[e.jsx(Mt,{children:o.name}),e.jsxs(At,{fullWidth:!0,...c,children:[e.jsx(me,{value:void 0,children:rn}),o.enum?o.enum?.map((m,v)=>e.jsx(me,{value:v,children:m},v)):new Array(l?.length).fill(" ").map((m,v)=>e.jsx(me,{value:l?.item(v)[a??""],children:l?.item(v)[n??""]},v))]})]})},G=0,J=t=>t!=null&&t!=="",ce=t=>!!t?.type;function cn(){const t=ReactRedux.useDispatch(),{subtitle:o,id:c}=st(),{index:d,config:n}=rt(s=>({index:s.DB[Y.index],config:s.DB[Y.config]})),{data:a,loading:l,refresh:h}=nt(()=>axios.get(`assets/${c}.json`).then(s=>s.data).catch(console.error),ft);oe(()=>{h()},[c]);const m=c??"",[v,x,S]=ae(0),[j,C,f]=ae(10),[P,k,B]=ae(0),b=Array.isArray(a)?a??[]:[],p=b.filter(s=>s.primary),g=b.reduce((s,i)=>{const r=i.foreignKey;return r&&(s[r]=i),s[i.id]=i,s},{}),$=b.map(s=>s.id),F=b.filter(s=>!!s.foreignKey).map(s=>String(s.foreignKey)),de=[...b.filter(s=>!s.foreignKey).map(s=>String(s.id)),...F],[U,O,Q]=ae(""),[ee,H]=M({}),Te=X(ee).filter(([s,i])=>J(i)&&$.includes(s)),Ee=React.useCallback(s=>b.reduce((i,r)=>(i[r.id]=r.type?!1:s,i),{}),[b]),Re=Ee(!1),[K,_e]=M(Re),gt=tn(K),[te,$e]=M(Re),Ce=d&&o===n?.[0]?.path?` INDEXED BY ${m}_Index`:"",ke=b.filter(s=>s.foreignTable).reduce((s,i)=>{const{foreignTable:r,id:u}=i;return s+`LEFT JOIN ${r} ON ${m}.${u}=${r}.${u} `}," ").trimEnd(),Le=` LIMIT ${f()} OFFSET ${f()*S()}`,ue=`SELECT * FROM ${m}${Ce}${ke}${Le};`,De=!Te.length?"":" WHERE "+Te.reduce((s,i)=>{const[r,u]=i;return J(u)?Array.isArray(u)?[...s,`(${r}>=${u[0]}) and (${r}<=${u[1]})`]:[...s,`${m}.${r} ${te[r]?`LIKE "%${String(u)}%"`:`= ${ce(g[r])?u:`"${u}"`}`} `]:s},[]).join(" and ").trimEnd(),{run:se}=ns(React.useCallback((s=U)=>{const i=s.trim().split(";");Z.transaction(r=>{for(let u of i)u&&r.executeSql(u,[],function(R,T){const{rows:y,rowsAffected:_}=T;_===0&&y?(jt({rows:y}),k(y.length)):t({type:w.OPENTRUE,payload:{[E.alertText]:`${u.split(" ")[0]}成功!`,[E.severity]:I.success}})})},r=>{Pe({severity:"error",alertText:`执行失败, 原因:${r.message}`}),t({type:w.OPENTRUE,payload:{[E.alertText]:`执行失败, 原因:${r.message}`,[E.severity]:I.error}})},()=>{Z.transaction(r=>{r.executeSql(`SELECT COUNT(*) FROM ${m}${De};`,[],function(u,R){const{rows:T}=R;k(T.item(0)["COUNT(*)"])})},r=>{},()=>{})})},[U,m]));React.useEffect(()=>ReactDOM.unstable_batchedUpdates(()=>{if(!a)return;O(ue),H(xe(ee).reduce((i,r)=>(i[r]=void 0,i),{}));const s={...Ee(!1),...[...xe(K),...xe(te)].reduce((i,r)=>(i[r]=!1,i),{})};_e(s),$e(s),re(()=>se(ue))}),[a]);const[yt,jt]=M({insertId:0,rowsAffected:0,rows:{length:0,item:()=>{}}});oe(()=>{const s=gt.every(i=>!i)?"*":X(K).reduce((i,r)=>{const[u,R]=r,T=g[u];return R?[...i,`${T?.foreignTable??m}.${T?.foreignKey??u}`]:i},[]).join(", ");O(`SELECT ${s} FROM ${m}${Ce}${ke}${De}${Le};`)},[ee,te,K,v,j,d]),oe(()=>{re(()=>se(Q()))},[v,j]);const L=yt?.rows,Ne=React.useMemo(()=>L.length?Object.keys(L.item(0)??{}).filter(s=>de.includes(s)):[],[L]),[we,Pe]=M({severity:"info",alertText:"待操作"}),{open:vt}=lt(s=>({open:s.SnackBar.open}));oe(()=>ReactDOM.unstable_batchedUpdates(()=>{re(()=>{const s={severity:"success",alertText:`执行成功, 查到 ${B()??L?.length} 条记录`};Pe(s),vt||t({type:w.OPENTRUE,payload:s})})}),[L]);const[Oe,ne]=M({open:!1,type:"UD",dialogData:L.length?L.item(0):{}}),{dialogData:St}=Oe,Me=s=>p.map(i=>{const{id:r}=i;return`${r}=${s[r]}`}).join(" AND ");return l||b.length===0?e.jsx(_t,{className:D.Skeleton??"",variant:"rounded",animation:"wave"}):e.jsxs(e.Fragment,{children:[e.jsxs(A,{elevation:24,className:D.Paper??"",children:[e.jsxs(Ae,{elevation:24,children:[e.jsx(Ie,{expandIcon:e.jsx(fe,{}),children:e.jsx(Be,{children:"筛选器"})}),e.jsx(Fe,{className:D.Input??"",children:b.map((s,i)=>{const{id:r}=s;return e.jsxs(A,{elevation:24,className:classNames({[D.last??""]:s.type==="between"})??"",children:[e.jsx(qe,{onChange:(u,R)=>{_e({[r]:R})},checked:K[r]}),(()=>{switch(s.type){case"enum":return e.jsx(ut,{fullWidth:!0,label:s.name,onChange:u=>{H({[r]:u.target.value})},i:s});case"between":{const u=ee[r];return e.jsxs(e.Fragment,{children:[e.jsx("span",{children:s.name}),e.jsx($t,{min:s.min??0,max:s.max??100,step:s.step??1,value:Array.isArray(u)?u:[0,100],onChange:(R,T,y)=>{if(!Array.isArray(T))return;const[_,q]=T,{id:pe}=s;if(_!==void 0&&q!==void 0)if(q-_{H({[r]:u.target.value})}}),e.jsx(et,{control:e.jsx(qe,{}),label:"模糊搜索",onChange:(u,R)=>$e({[r]:R}),checked:te[r]})]})}})()]},i)})})]}),e.jsxs(Ae,{elevation:24,className:D.sqlInput??"",children:[e.jsx(Ie,{expandIcon:e.jsx(fe,{}),children:e.jsx(Be,{children:"SQL执行"})}),e.jsxs(Fe,{className:D.AccordionDetails??"",children:[e.jsx(ie,{multiline:!0,autoFocus:!0,fullWidth:!0,"aria-autocomplete":"both",label:"SQL",onChange:s=>O(s.target.value),value:U}),e.jsx(N,{size:"large",variant:"contained",onClick:s=>{x(i=>(i||se(Q()),0))},children:"Transaction"})]})]}),e.jsx(A,{elevation:24,className:D.fullWidth??"",children:e.jsx(tt,{severity:we.severity,variant:"filled",children:we.alertText})}),e.jsxs(A,{elevation:24,children:[e.jsx(Ct,{children:e.jsxs(kt,{stickyHeader:!0,children:[e.jsx(Lt,{children:e.jsx(Ue,{children:Ne.map((s,i)=>e.jsx(Qe,{align:"center",title:s,children:g[s]?.name??s},i))})}),e.jsx(Dt,{children:new Array(L.length).fill(" ").map((s,i)=>e.jsx(Ue,{hover:!0,children:Ne.map((r,u)=>{const R=g[r],T=R?.id,y=L?.item(i),_=R?.enum,q=y[r];return React.createElement(Qe,{...T&&{title:String(y[T])},key:u,align:"center",...g[r]?.primary&&{onClick:()=>{ne({open:!0,type:"UD",dialogData:y})},className:D.aLink??""}},_&&J(q)?_[Number(q)]:q)})},i))})]})}),e.jsx(Nt,{component:"div",count:P??L?.length??10,rowsPerPage:j,page:v,onPageChange:(s,i)=>{x(i)},onRowsPerPageChange:s=>ReactDOM.unstable_batchedUpdates(()=>{C(+s.target.value),x(0)}),labelDisplayedRows:s=>`${s.from}-${isNaN(s.to)?1:s.to}/共${s.count??0}项`,labelRowsPerPage:"每页行数:"})]}),e.jsx(A,{elevation:24,children:e.jsx(wt,{color:"primary",size:"large",onClick:()=>ReactDOM.unstable_batchedUpdates(()=>{ne({open:!0,type:"C",dialogData:b.reduce((s,i)=>(s[i.id]="",s),{})})}),children:e.jsx(Pt,{})})})]}),e.jsx(ln,{onClose:()=>ne({open:!1}),className:D.dialog??"",...Oe,dialogDataProps:St,idToNameRecord:g,idToNameKeys:$,idToNamePrimary:p,idToName:b,comfirm:s=>ReactDOM.unstable_batchedUpdates(()=>{O(s),se(`${s};${ue}`),ne({open:!1})}),modifySQL:s=>{const i=X(s).filter(([r])=>$.includes(r)&&!g[r]?.primary).map(([r,u])=>`${r}=${J(u)?ce(g[r])?u:`'${u}'`:"null"}`).join(", ");return`UPDATE ${m} SET ${i} WHERE ${Me(s)};`},deleteSQL:s=>`DELETE FROM ${m} WHERE ${Me(s)};`,insertSQL:s=>{const i=X(s).filter(([y,_])=>J(_)&&$.includes(y)),r=p.map(y=>y.id),u=i.map(([y])=>y);if(r.some(y=>!u.includes(y)))return t({type:w.OPENTRUE,payload:{[E.alertText]:"还有必填项未填写",[E.severity]:I.warning}}),"";const R=i.map(([y])=>y).join(", "),T=i.map(([y,_])=>`${ce(g[y])?_:`'${_}'`}`).join(", ");return`INSERT INTO ${m} (${R}) VALUES (${T});`}})]})}const ln=t=>{const{type:o,dialogDataProps:c,idToNameRecord:d,idToNameKeys:n,modifySQL:a,deleteSQL:l,comfirm:h,idToNamePrimary:m,insertSQL:v,idToName:x,...S}=t,[j,C]=M(c),[f,P]=M({open:!1,text:"",code:""}),k=o==="UD";React.useEffect(()=>{C(c)},[c,open]);const B=()=>{P({open:!1})},b=(p,g)=>k?{defaultValue:p,disabled:!!g}:{required:!!g};return e.jsxs(e.Fragment,{children:[e.jsxs(ge,{...S,children:[X(j??{}).filter(([p])=>n.includes(p)).map(([p,g],$)=>{const F=d[p],be=F?.type,de=ce(F),U=F.primary;return F&&be==="enum"?e.jsx(ut,{i:F,...b(g,U),label:p,onChange:O=>{const{value:Q}=O.target;C({[p]:Q})}},$):React.createElement(ie,{"aria-autocomplete":"both",label:p,type:de?"number":"search",...b(g,U),key:$,onChange:O=>{const{value:Q}=O.target;C({[p]:Q})}})}),k?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"large",variant:"contained",onClick:()=>{P({open:!0,text:"确认修改?",code:a(j)})},children:"修改"}),e.jsx(N,{size:"large",variant:"outlined",color:"error",onClick:()=>{P({open:!0,text:"确认删除?",code:l(j)})},children:"删除"})]}):e.jsx(N,{size:"large",variant:"contained",onClick:()=>{const p=v(j);p&&P({open:!0,text:"确认新增?",code:p})},children:"新增"})]}),e.jsxs(ge,{open:f.open,onClose:B,className:D.dialog??"",children:[e.jsx("h1",{children:f.text}),e.jsx(ie,{defaultValue:f.code,onChange:p=>P({code:p.target.value}),autoFocus:!0,"aria-autocomplete":"both",label:"sql",type:"search",multiline:!0,fullWidth:!0}),e.jsx(N,{size:"large",variant:"outlined",color:"warning",onClick:()=>{h(f.code),B()},children:"确认"}),e.jsx(N,{size:"large",variant:"contained",onClick:B,children:"取消"})]})]})},pt=({...t})=>e.jsx(N,{variant:"contained",size:"large",...t}),dn=()=>window.caches?.keys()?.then(t=>t.forEach(o=>window.caches?.delete(o))).catch(console.error),un=t=>{const{open:o=!1,handleClose:c,onClick:d,title:n,content:a}=t;return e.jsxs(ge,{open:o,keepMounted:!0,onClose:c,children:[e.jsx(Wt,{children:n}),a&&e.jsx(Kt,{children:a}),e.jsxs(Vt,{className:z.DialogActions??"",children:[e.jsx(N,{variant:"outlined",onClick:c,size:"large",children:"取消"}),e.jsx(pt,{onClick:d,children:"确定"})]})]})},pn=t=>{var o=document.createElement("textarea");o.value=t,document.body.append(o),o.select(),document.execCommand("copy"),o.remove()},Je=(t,o,c)=>{let d=setTimeout(()=>{re(()=>location.reload())},5e3);fetch(`assets/${t}.sql`).then(n=>n.text()).then(n=>{const a=n.trim().split(";");Z.transaction(l=>{for(let h of a)h&&l.executeSql(h+";",[])},l=>{o({type:w.OPENTRUE,payload:{[E.alertText]:`执行失败, 原因:${l.message}`,[E.severity]:I.error}}),clearTimeout(d)},()=>{o({type:w.OPENTRUE,payload:{[E.alertText]:c,[E.severity]:I.success}})})})};function mn(t){as(()=>{fetch("assets/TRIGGER.sql").then(p=>p.text()).then(pn).catch(console.error)});const o=ys(p=>p.AppBarTitle[at.title]),[c,d]=React.useState(null),[n,a]=React.useState(!1),l=()=>{a(!1)},h=!!c,{setMenuToggle:m,...v}=t,x=React.useContext(Se),[S,j]=React.useState(!1),{subtitle:C,id:f}=st(),P=ReactRedux.useDispatch(),k=ReactRedux.useDispatch(),{index:B,config:b}=rt(p=>({index:p.DB[Y.index],config:p.DB[Y.config]}));return e.jsxs(React.StrictMode,{children:[e.jsxs(It,{position:"sticky",className:z.AppBar??"",...v,children:[e.jsx(Bt,{onClick:x?m:j.bind(null,!0),className:z.menuIcon??"",size:"large",children:e.jsx(Ft,{})}),e.jsx("span",{onClick:()=>{const g=prompt("运行单条SQL代码")?.trim();g&&Z.transaction($=>{$.executeSql(g,[])},$=>{k({type:w.OPENTRUE,payload:{[E.alertText]:`执行失败, 原因:${$.message}`,[E.severity]:I.error}})},()=>{k({type:w.OPENTRUE,payload:{[E.alertText]:`${g}
-执行成功`,[E.severity]:I.success}})})},children:(o||f)??le}),e.jsxs(N,{className:classNames(z.Avatar,{[z.open??""]:h}),onClick:p=>{d(p.currentTarget)},children:[e.jsx(qt,{}),e.jsx("span",{children:"HJX, HJX"}),e.jsx(Ut,{})]})]}),e.jsxs(Qt,{anchorEl:c,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},open:h,onClose:()=>{d(null)},className:z.Popover??"",children:[C===b?.[0]?.path&&e.jsx(et,{control:e.jsx(Ht,{}),label:"索引",onChange:(p,g)=>{P({type:je.SET,payload:{index:g}})},checked:B??!1}),f&&e.jsxs(pt,{fullWidth:!0,onClick:()=>ReactDOM.unstable_batchedUpdates(()=>{d(null),a(!0)}),children:["重置",f,"表"]}),e.jsx(N,{fullWidth:!0,onClick:()=>{confirm("确定要删库跑路吗?")&&b?.map(p=>p.children).flat().forEach(p=>{Je(p,k,`删${p}库跑路成功! 5秒后自动刷新`)}),l()},color:"error",variant:"outlined",children:"删库跑路"})]}),e.jsx(un,{open:n,handleClose:l,title:`确定要重置${f}表吗?`,onClick:()=>{dn(),localStorage.clear(),Je(f??"",k,`重置${f}表成功! 5秒后自动刷新`),l()}}),e.jsx(zt,{anchor:"left",open:!x&&S,onClose:j.bind(null,!1),children:e.jsx(ve,{})})]})}const hn="_MainFrame_jou1o_1",xn={MainFrame:hn};function fn(){const[t,{toggle:o}]=rs(!0),c=React.useContext(Se);return e.jsxs(React.StrictMode,{children:[e.jsx(mn,{setMenuToggle:o}),e.jsxs("div",{className:xn.MainFrame,style:{"--gap":t?"9q":0},children:[e.jsx(Ze,{in:t&&c,orientation:"horizontal",children:e.jsx(A,{elevation:24,children:e.jsx(ve,{})})}),e.jsx("div",{children:e.jsx(Zt,{})})]})]})}const mt=React.lazy(()=>ls(()=>Promise.resolve().then(()=>Qs),void 0,import.meta.url)),gn=[{path:"",id:"目录",element:e.jsx(React.Suspense,{fallback:e.jsx(ye,{}),children:e.jsx(mt,{})})}],ht=(...t)=>`/${t.join("/")}`;function yn(){return e.jsx(es,{children:e.jsxs(he,{element:e.jsx(fn,{}),children:[e.jsx(he,{index:!0,element:e.jsx(React.Suspense,{fallback:e.jsx(Xe,{open:!0,children:e.jsx(ye,{})}),children:e.jsx(mt,{})})}),e.jsx(he,{path:":subtitle/:id",element:e.jsx(cn,{})})]})})}const jn=Redux.combineReducers({SnackBar:en,AppBarTitle:gs,DB:Rs}),xt=Redux.legacy_createStore(jn,Redux.applyMiddleware(ReduxThunk));xt.subscribe(()=>{});const vn="_Snackbar_1t4e7_1",Sn={Snackbar:vn};function bn(){const{open:t,alertText:o,severity:c}=lt(a=>({open:a.SnackBar.open,alertText:a.SnackBar.alertText,severity:a.SnackBar.severity})),d=ReactRedux.useDispatch(),n=(a,l)=>{l!=="clickaway"&&d({type:w.OPENFALSE})};return e.jsx(React.StrictMode,{children:e.jsx(Gt,{open:!!(t&&o),autoHideDuration:6e3,onClose:n,message:o,className:Sn.Snackbar??"",children:e.jsx(tt,{onClose:n,severity:c,variant:"filled",children:o})})})}const ft={loadingDelay:300,throttleWait:300},Se=React.createContext(!1),Tn=()=>{const t=Jt("(orientation:landscape)");return e.jsx(React.StrictMode,{children:e.jsx(Ye,{injectFirst:!0,children:e.jsxs(Xt,{children:[e.jsx(Yt,{}),e.jsx(ReactRedux.Provider,{store:xt,children:e.jsxs(Se.Provider,{value:t,children:[e.jsx(ss,{children:e.jsx(yn,{})}),e.jsx(bn,{})]})})]})})})};ReactDOM.render(e.jsx(React.StrictMode,{children:e.jsx(Tn,{})}),document.body);
-function __vite__mapDeps(indexes) {
- if (!__vite__mapDeps.viteFileDeps) {
- __vite__mapDeps.viteFileDeps = []
- }
- return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
-}
diff --git a/dist/js/main-mjhR0BsP.js b/dist/js/main-mjhR0BsP.js
new file mode 100644
index 0000000..b3820c9
--- /dev/null
+++ b/dist/js/main-mjhR0BsP.js
@@ -0,0 +1,8 @@
+import{j as e}from"./react-ejZHSj7z.js";import{B as Ye,C as ve,S as Ze,L as bt,D as Et,a as _t,d as ye,b as et,c as $t,P as I,e as Ct,A as Ae,f as Ie,T as Be,g as Fe,h as qe,i as le,F as tt,j as kt,k as N,l as st,m as Lt,n as Dt,o as Nt,p as Ue,q as Qe,r as wt,s as Pt,t as Ot,u as Mt,v as At,I as It,w as Bt,M as fe,x as je,y as Ft,z as qt,E as Ut,G as Qt,H as Ht,J as zt,K as Wt,N as Gt,O as Kt,Q as Vt,R as Jt,U as Xt,V as Yt,W as Zt,X as es}from"./@mui-_A7eRbnw.js";import{d as nt,O as ts,e as ss,f as xe}from"./react-router-y82kxMFL.js";import{N as ns,H as os}from"./react-router-dom-v3GnXs1D.js";import{u as ot,a as re,b as ce,c as A,d as as,e as rs,f as cs,g as is}from"./ahooks-LOzqvy8i.js";import{c as at}from"./copy-text-to-clipboard-SBA1EQaE.js";import"./object-assign-4_VUvG2Z.js";import"./@emotion-tNa4IMmz.js";import"./hoist-non-react-statics-o0ngdJFr.js";import"./@babel-moqvDIRK.js";import"./stylis-UTZzoVRx.js";import"./clsx-2Jv0kmJG.js";import"./@remix-run-Tfa50bkj.js";import"./tslib-g6pQwBLH.js";import"./lodash-liWoq_f8.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))d(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&d(l)}).observe(document,{childList:!0,subtree:!0});function c(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function d(o){if(o.ep)return;o.ep=!0;const a=c(o);fetch(o.href,a)}})();const ls="modulepreload",ds=function(t,n){return new URL(t,n).href},He={},us=function(n,c,d){let o=Promise.resolve();if(c&&c.length>0){const a=document.getElementsByTagName("link");o=Promise.all(c.map(l=>{if(l=ds(l,d),l in He)return;He[l]=!0;const h=l.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(!!d)for(let S=a.length-1;S>=0;S--){const j=a[S];if(j.href===l&&(!h||j.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${p}`))return;const x=document.createElement("link");if(x.rel=h?"stylesheet":ls,h||(x.as="script",x.crossOrigin=""),x.href=l,document.head.appendChild(x),h)return new Promise((S,j)=>{x.addEventListener("load",S),x.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${l}`)))})}))}return o.then(()=>n()).catch(a=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a})},ps="_AppBar_n6byb_1",hs="_menuIcon_n6byb_11",ms="_Avatar_n6byb_19",fs="_open_n6byb_27",xs="_Popover_n6byb_39",gs="_DialogActions_n6byb_57",W={AppBar:ps,menuIcon:hs,Avatar:ms,open:fs,Popover:xs,DialogActions:gs};var rt=(t=>(t.SET_TITLE="SET_TITLE",t))(rt||{}),ct=(t=>(t.title="title",t))(ct||{});const ys={title:""},js=(t=ys,n)=>{const{type:c,payload:d={}}=n;switch(c){case"SET_TITLE":return{...t,...d};default:return t}},vs=ReactRedux.useSelector,Ss="_NavLink_1kxee_1",Ts="_CollapseClick_1kxee_8",Rs="_ArrowDownIcon_1kxee_11",bs="_overview_1kxee_15",Es="_ListItemButton_1kxee_20",G={NavLink:Ss,CollapseClick:Ts,ArrowDownIcon:Rs,overview:bs,ListItemButton:Es};var de=(t=>(t.SET="SET",t))(de||{}),K=(t=>(t.config="config",t.index="index",t.TRIGGER="TRIGGER",t))(K||{});const _s={config:[],index:!1,TRIGGER:""},$s=(t=_s,n)=>{const{type:c,payload:d={}}=n;switch(c){case"SET":return{...t,...d};default:return t}},it=ReactRedux.useSelector,lt=({className:t,...n})=>e.jsx($t,{className:classNames(t,G.ListItemButton),...n}),dt=t=>{const{text:n="",path:c="",setOpen:d,...o}=t,[a,l]=React.useState(!1),[h,p]=React.useState(!0),y=ReactRedux.useDispatch();return e.jsx(lt,{selected:a,disableGutters:!0,onClick:x=>{const{target:S}=x;if(HTMLDivElement.prototype.isPrototypeOf(S)&&S instanceof HTMLDivElement&&Object.prototype.toString.call(S)==="[object HTMLDivElement]"&&S.constructor===HTMLDivElement&&typeof S=="object"){const{children:j,childNodes:k}=S,R=j.item(0)??j[0]??k[0]??k.values().next().value??document.createElement("a");HTMLAnchorElement.prototype.isPrototypeOf(R)&&R instanceof HTMLAnchorElement&&Object.prototype.toString.call(R)==="[object HTMLAnchorElement]"&&R.constructor===HTMLAnchorElement&&typeof R=="object"&&R.click()}},...o,children:e.jsx(ns,{to:c,className:({isActive:x})=>ReactDOM.unstable_batchedUpdates(()=>(l(x),x&&h&&d?.(),p(!1),G.NavLink)),onClick:()=>{y({type:rt.SET_TITLE,payload:{title:n}}),document.title=n},children:n})})},Cs=({item:t})=>{const{children:n,id:c,path:d=""}=t,[o,a]=React.useState(!1);return e.jsxs(React.StrictMode,{children:[e.jsxs(lt,{onClick:a.bind(null,!o),className:classNames(G.CollapseClick,{[G.CollapseClickActive??""]:o}),children:[e.jsx(_t,{primary:c}),e.jsx(ye,{className:classNames({[G.ArrowDownIcon??""]:o})})]}),e.jsx(et,{in:o,children:e.jsx("ul",{children:n?.map((l,h)=>e.jsx("li",{children:e.jsx(dt,{text:l.id??"",path:xt(d,l.path??""),setOpen:a.bind(null,!0)})},h))})})]})};function Se(){const t=ReactRedux.useDispatch(),{data:n,loading:c}=ot(()=>axios.get("assets/config.json").then(o=>{const{data:a}=o;return t({type:de.SET,payload:{config:a}}),a}).catch(console.error),yt);if(c||!n)return e.jsx(Ye,{open:!0,children:e.jsx(ve,{})});const d=n.map(o=>({id:o.path,path:o.path,children:o.children.map(a=>({path:a,id:a}))}));return e.jsx(React.StrictMode,{children:e.jsx(Ze,{injectFirst:!0,children:[...jn,...d].map((o,a)=>{const{children:l,id:h="",path:p=""}=o;return e.jsxs(React.StrictMode,{children:[e.jsx(bt,{children:l?e.jsx(Cs,{item:o}):e.jsx(dt,{text:h,path:xt(p),className:G.overview??""})},a),e.jsx(Et,{})]})})})})}const ks="_Paper_p9qzm_1",Ls={Paper:ks},{queueMicrotask:Ds,setTimeout:Ns,Promise:ze,requestIdleCallback:ws,requestAnimationFrame:Ps,console:We,MessageChannel:Os}=window??self??globalThis??global??void 0,ee=(t=()=>{})=>{const n=(c=()=>{})=>ws?.(()=>Ns?.(()=>Ps?.(()=>Ds?.(()=>ze?.resolve?.()?.then?.(()=>{const{port1:d,port2:o}=new Os;o.onmessage=()=>c?.(),d?.postMessage?.(null)}).catch?.(We?.error)))));return new ze(c=>n?.(c))?.then?.(()=>n?.(t)).catch?.(We?.error)},{addEventListener:Ms,queueMicrotask:As,setTimeout:Is,Promise:Ge,requestIdleCallback:Bs,requestAnimationFrame:Fs,console:Ke,MessageChannel:qs}=window??self??globalThis??global??void 0,Us=(t=()=>{})=>{const n=(c=()=>{})=>Bs?.(()=>Is?.(()=>Fs?.(()=>As?.(()=>Ge?.resolve?.()?.then?.(()=>{const{port1:d,port2:o}=new qs;o.onmessage=()=>c?.(),d?.postMessage?.(null)}).catch?.(Ke?.error)))));return Ms("load",()=>new Ge(c=>n?.(c))?.then?.(()=>n?.(t)).catch?.(Ke?.error))},Ve={elevation:24,className:Ls.Paper??""},ue="WebSQL",{addEventListener:Un,document:Qs,navigator:Qn,Object:Hn,console:zn}=window??self??globalThis??global??void 0;Us(()=>Qs.title=ue);function Hs(){return e.jsxs(React.StrictMode,{children:[e.jsx(I,{...Ve,children:ue}),e.jsx(I,{...Ve,children:e.jsx(Se,{})})]})}const zs=Object.freeze(Object.defineProperty({__proto__:null,default:Hs,documentTitle:ue},Symbol.toStringTag,{value:"Module"})),Ws="_Paper_1ieip_2",Gs="_Input_1ieip_22",Ks="_sqlInput_1ieip_41",Vs="_AccordionDetails_1ieip_48",Js="_last_1ieip_57",Xs="_fullWidth_1ieip_65",Ys="_aLink_1ieip_71",Zs="_Skeleton_1ieip_79",en="_dialog_1ieip_84",D={Paper:Ws,Input:Gs,sqlInput:Ks,AccordionDetails:Vs,last:Js,fullWidth:Xs,aLink:Ys,Skeleton:Zs,dialog:en};var w=(t=>(t.SnackbarAlert="SnackbarAlert",t.OPENTRUE="OPENTRUE",t.OPENFALSE="OPENFALSE",t))(w||{}),E=(t=>(t.alertText="alertText",t.open="open",t.severity="severity",t))(E||{}),B=(t=>(t.error="error",t.info="info",t.success="success",t.warning="warning",t))(B||{});const tn={alertText:"",open:!1,severity:"success"},sn=(t=tn,n)=>{const{type:c,payload:d={}}=n,o=a=>({...t,...d,open:a});switch(c){case"OPENFALSE":return o(!1);case"OPENTRUE":return o(!0);default:return t}},ut=ReactRedux.useSelector,{entries:Z,values:nn,keys:ge}=Object,on=window??global??globalThis??self??void 0,pt="table",an="1.0",rn=pt,cn=2*1024*1024,te=on.openDatabase(pt,an,rn,cn,t=>{}),ln="未选择",ht=t=>{const{i:n,...c}=t,{foreignTable:d,foreignKey:o,id:a}=n,[l,h]=rs();return React.useEffect(()=>{d&&o&&te.transaction(p=>{p.executeSql(`SELECT * FROM ${d}`,[],function(y,x){h(x.rows)})},p=>{},()=>{})},[d,o]),e.jsxs(At,{fullWidth:!0,children:[e.jsx(It,{children:n.name}),e.jsxs(Bt,{fullWidth:!0,...c,children:[e.jsx(fe,{value:void 0,children:ln}),n.enum?n.enum?.map((p,y)=>e.jsx(fe,{value:y,children:p},y)):new Array(l?.length).fill(" ").map((p,y)=>e.jsx(fe,{value:l?.item(y)[a??""],children:l?.item(y)[o??""]},y))]})]})},X=0,Y=t=>t!=null&&t!=="",ie=t=>!!t?.type;function dn(){const t=ReactRedux.useDispatch(),{subtitle:n,id:c}=nt(),{index:d,config:o}=it(s=>({index:s.DB[K.index],config:s.DB[K.config]})),{data:a,loading:l,refresh:h}=ot(()=>axios.get(`assets/${c}.json`).then(s=>s.data).catch(console.error),yt);re(()=>{h()},[c]);const p=c??"",[y,x,S]=ce(0),[j,k,R]=ce(10),[P,O,F]=ce(0),T=Array.isArray(a)?a??[]:[],v=T.filter(s=>s.primary),m=T.reduce((s,i)=>{const r=i.foreignKey;return r&&(s[r]=i),s[i.id]=i,s},{}),f=T.map(s=>s.id),$=T.filter(s=>!!s.foreignKey).map(s=>String(s.foreignKey)),pe=[...T.filter(s=>!s.foreignKey).map(s=>String(s.id)),...$],[Q,M,H]=ce(""),[se,z]=A({}),Re=Z(se).filter(([s,i])=>Y(i)&&f.includes(s)),be=React.useCallback(s=>T.reduce((i,r)=>(i[r.id]=r.type?!1:s,i),{}),[T]),Ee=be(!1),[V,_e]=A(Ee),jt=nn(V),[ne,$e]=A(Ee),Ce=d&&n===o?.[0]?.path?` INDEXED BY ${p}_Index`:"",ke=T.filter(s=>s.foreignTable).reduce((s,i)=>{const{foreignTable:r,id:u}=i;return s+`LEFT JOIN ${r} ON ${p}.${u}=${r}.${u} `}," ").trimEnd(),Le=` LIMIT ${R()} OFFSET ${R()*S()}`,he=`SELECT * FROM ${p}${Ce}${ke}${Le};`,De=!Re.length?"":" WHERE "+Re.reduce((s,i)=>{const[r,u]=i;return Y(u)?Array.isArray(u)?[...s,`(${r}>=${u[0]}) and (${r}<=${u[1]})`]:[...s,`${p}.${r} ${ne[r]?`LIKE "%${String(u)}%"`:`= ${ie(m[r])?u:`"${u}"`}`} `]:s},[]).join(" and ").trimEnd(),{run:oe}=as(React.useCallback((s=Q)=>{const i=s.trim().split(";");te.transaction(r=>{for(let u of i)u&&r.executeSql(u,[],function(_,b){const{rows:g,rowsAffected:C}=b;C===0&&g?(St({rows:g}),O(g.length)):t({type:w.OPENTRUE,payload:{[E.alertText]:`${u.split(" ")[0]}成功!`,[E.severity]:B.success}})})},r=>{Pe({severity:"error",alertText:`执行失败, 原因:${r.message}`}),t({type:w.OPENTRUE,payload:{[E.alertText]:`执行失败, 原因:${r.message}`,[E.severity]:B.error}})},()=>{te.transaction(r=>{r.executeSql(`SELECT COUNT(*) FROM ${p}${De};`,[],function(u,_){const{rows:b}=_;O(b.item(0)["COUNT(*)"])})},r=>{},()=>{})})},[Q,p]));React.useEffect(()=>ReactDOM.unstable_batchedUpdates(()=>{if(!a)return;M(he),z(ge(se).reduce((i,r)=>(i[r]=void 0,i),{}));const s={...be(!1),...[...ge(V),...ge(ne)].reduce((i,r)=>(i[r]=!1,i),{})};_e(s),$e(s),ee(()=>oe(he))}),[a]);const[vt,St]=A({insertId:0,rowsAffected:0,rows:{length:0,item:()=>{}}});re(()=>{const s=jt.every(i=>!i)?"*":Z(V).reduce((i,r)=>{const[u,_]=r,b=m[u];return _?[...i,`${b?.foreignTable??p}.${b?.foreignKey??u}`]:i},[]).join(", ");M(`SELECT ${s} FROM ${p}${Ce}${ke}${De}${Le};`)},[se,ne,V,y,j,d]),re(()=>{ee(()=>oe(H()))},[y,j]);const L=vt?.rows,Ne=React.useMemo(()=>L.length?Object.keys(L.item(0)??{}).filter(s=>pe.includes(s)):[],[L]),[we,Pe]=A({severity:"info",alertText:"待操作"}),{open:Tt}=ut(s=>({open:s.SnackBar.open}));re(()=>ReactDOM.unstable_batchedUpdates(()=>{ee(()=>{const s={severity:"success",alertText:`执行成功, 查到 ${F()??L?.length} 条记录`};Pe(s),Tt||t({type:w.OPENTRUE,payload:s})})}),[L]);const[Oe,ae]=A({open:!1,type:"UD",dialogData:L.length?L.item(0):{}}),{dialogData:Rt}=Oe,Me=s=>v.map(i=>{const{id:r}=i;return`${r}=${s[r]}`}).join(" AND ");return l||T.length===0?e.jsx(Ct,{className:D.Skeleton??"",variant:"rounded",animation:"wave"}):e.jsxs(e.Fragment,{children:[e.jsxs(I,{elevation:24,className:D.Paper??"",children:[e.jsxs(Ae,{elevation:24,children:[e.jsx(Ie,{expandIcon:e.jsx(ye,{}),children:e.jsx(Be,{children:"筛选器"})}),e.jsx(Fe,{className:D.Input??"",children:T.map((s,i)=>{const{id:r}=s;return e.jsxs(I,{elevation:24,className:classNames({[D.last??""]:s.type==="between"})??"",children:[e.jsx(qe,{onChange:(u,_)=>{_e({[r]:_})},checked:V[r]}),(()=>{switch(s.type){case"enum":return e.jsx(ht,{fullWidth:!0,label:s.name,onChange:u=>{z({[r]:u.target.value})},i:s});case"between":{const u=se[r];return e.jsxs(e.Fragment,{children:[e.jsx("span",{children:s.name}),e.jsx(kt,{min:s.min??0,max:s.max??100,step:s.step??1,value:Array.isArray(u)?u:[0,100],onChange:(_,b,g)=>{if(!Array.isArray(b))return;const[C,q]=b,{id:me}=s;if(C!==void 0&&q!==void 0)if(q-C{z({[r]:u.target.value})}}),e.jsx(tt,{control:e.jsx(qe,{}),label:"模糊搜索",onChange:(u,_)=>$e({[r]:_}),checked:ne[r]})]})}})()]},i)})})]}),e.jsxs(Ae,{elevation:24,className:D.sqlInput??"",children:[e.jsx(Ie,{expandIcon:e.jsx(ye,{}),children:e.jsx(Be,{children:"SQL执行"})}),e.jsxs(Fe,{className:D.AccordionDetails??"",children:[e.jsx(le,{multiline:!0,autoFocus:!0,fullWidth:!0,"aria-autocomplete":"both",label:"SQL",onChange:s=>M(s.target.value),value:Q}),e.jsx(N,{size:"large",variant:"contained",onClick:s=>{x(i=>(i||oe(H()),0))},children:"Transaction"})]})]}),e.jsx(I,{elevation:24,className:D.fullWidth??"",children:e.jsx(st,{severity:we.severity,variant:"filled",children:we.alertText})}),e.jsxs(I,{elevation:24,children:[e.jsx(Lt,{children:e.jsxs(Dt,{stickyHeader:!0,children:[e.jsx(Nt,{children:e.jsx(Ue,{children:Ne.map((s,i)=>e.jsx(Qe,{align:"center",title:s,children:m[s]?.name??s},i))})}),e.jsx(wt,{children:new Array(L.length).fill(" ").map((s,i)=>e.jsx(Ue,{hover:!0,children:Ne.map((r,u)=>{const _=m[r],b=_?.id,g=L?.item(i),C=_?.enum,q=g[r];return React.createElement(Qe,{...b&&{title:String(g[b])},key:u,align:"center",...m[r]?.primary&&{onClick:()=>{ae({open:!0,type:"UD",dialogData:g})},className:D.aLink??""}},C&&Y(q)?C[Number(q)]:q)})},i))})]})}),e.jsx(Pt,{component:"div",count:P??L?.length??10,rowsPerPage:j,page:y,onPageChange:(s,i)=>{x(i)},onRowsPerPageChange:s=>ReactDOM.unstable_batchedUpdates(()=>{k(+s.target.value),x(0)}),labelDisplayedRows:s=>`${s.from}-${isNaN(s.to)?1:s.to}/共${s.count??0}项`,labelRowsPerPage:"每页行数:"})]}),e.jsx(I,{elevation:24,children:e.jsx(Ot,{color:"primary",size:"large",onClick:()=>ReactDOM.unstable_batchedUpdates(()=>{ae({open:!0,type:"C",dialogData:T.reduce((s,i)=>(s[i.id]="",s),{})})}),children:e.jsx(Mt,{})})})]}),e.jsx(un,{onClose:()=>ae({open:!1}),className:D.dialog??"",...Oe,dialogDataProps:Rt,idToNameRecord:m,idToNameKeys:f,idToNamePrimary:v,idToName:T,comfirm:s=>ReactDOM.unstable_batchedUpdates(()=>{M(s),oe(`${s};${he}`),ae({open:!1})}),modifySQL:s=>{const i=Z(s).filter(([r])=>f.includes(r)&&!m[r]?.primary).map(([r,u])=>`${r}=${Y(u)?ie(m[r])?u:`'${u}'`:"null"}`).join(", ");return`UPDATE ${p} SET ${i} WHERE ${Me(s)};`},deleteSQL:s=>`DELETE FROM ${p} WHERE ${Me(s)};`,insertSQL:s=>{const i=Z(s).filter(([g,C])=>Y(C)&&f.includes(g)),r=v.map(g=>g.id),u=i.map(([g])=>g);if(r.some(g=>!u.includes(g)))return t({type:w.OPENTRUE,payload:{[E.alertText]:"还有必填项未填写",[E.severity]:B.warning}}),"";const _=i.map(([g])=>g).join(", "),b=i.map(([g,C])=>`${ie(m[g])?C:`'${C}'`}`).join(", ");return`INSERT INTO ${p} (${_}) VALUES (${b});`}})]})}const un=t=>{const{type:n,dialogDataProps:c,idToNameRecord:d,idToNameKeys:o,modifySQL:a,deleteSQL:l,comfirm:h,idToNamePrimary:p,insertSQL:y,idToName:x,...S}=t,[j,k]=A(c),[R,P]=A({open:!1,text:"",code:""}),O=n==="UD";React.useEffect(()=>{k(c)},[c,open]);const F=()=>{P({open:!1})},T=(v,m)=>O?{defaultValue:v,disabled:!!m}:{required:!!m};return e.jsxs(e.Fragment,{children:[e.jsxs(je,{...S,children:[Z(j??{}).filter(([v])=>o.includes(v)).map(([v,m],f)=>{const $=d[v],U=$?.type,pe=ie($),Q=$.primary;return $&&U==="enum"?e.jsx(ht,{i:$,...T(m,Q),label:v,onChange:M=>{const{value:H}=M.target;k({[v]:H})}},f):React.createElement(le,{"aria-autocomplete":"both",label:v,type:pe?"number":"search",...T(m,Q),key:f,onChange:M=>{const{value:H}=M.target;k({[v]:H})}})}),O?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"large",variant:"contained",onClick:()=>{P({open:!0,text:"确认修改?",code:a(j)})},children:"修改"}),e.jsx(N,{size:"large",variant:"outlined",color:"error",onClick:()=>{P({open:!0,text:"确认删除?",code:l(j)})},children:"删除"})]}):e.jsx(N,{size:"large",variant:"contained",onClick:()=>{const v=y(j);v&&P({open:!0,text:"确认新增?",code:v})},children:"新增"})]}),e.jsxs(je,{open:R.open,onClose:F,className:D.dialog??"",children:[e.jsx("h1",{children:R.text}),e.jsx(le,{defaultValue:R.code,onChange:v=>P({code:v.target.value}),autoFocus:!0,"aria-autocomplete":"both",label:"sql",type:"search",multiline:!0,fullWidth:!0}),e.jsx(N,{size:"large",variant:"outlined",color:"warning",onClick:()=>{h(R.code),F()},children:"确认"}),e.jsx(N,{size:"large",variant:"contained",onClick:F,children:"取消"})]})]})},{error:Je}=console,mt=({...t})=>e.jsx(N,{variant:"contained",size:"large",...t}),pn=()=>window.caches?.keys()?.then(t=>t.forEach(n=>window.caches?.delete(n))).catch(console.error),hn=t=>{const{open:n=!1,handleClose:c,onClick:d,title:o,content:a}=t;return e.jsxs(je,{open:n,keepMounted:!0,onClose:c,children:[e.jsx(Kt,{children:o}),a&&e.jsx(Vt,{children:a}),e.jsxs(Jt,{className:W.DialogActions??"",children:[e.jsx(N,{variant:"outlined",onClick:c,size:"large",children:"取消"}),e.jsx(mt,{onClick:d,children:"确定"})]})]})},Xe=(t,n,c)=>{let d=setTimeout(()=>{ee(()=>location.reload())},5e3);fetch(`assets/${t}.sql`).then(o=>o.text()).then(o=>{const a=o.trim().split(";");te.transaction(l=>{for(let h of a)h&&l.executeSql(h+";",[])},l=>{n({type:w.OPENTRUE,payload:{[E.alertText]:`执行失败, 原因:${l.message}`,[E.severity]:B.error}}),clearTimeout(d)},()=>{n({type:w.OPENTRUE,payload:{[E.alertText]:c,[E.severity]:B.success}})})})},mn=t=>fetch("assets/TRIGGER.sql").then(n=>n.text()).then(n=>(t({type:de.SET,payload:{TRIGGER:n}}),n??"")).then(at,Je).catch(Je);function fn(t){const n=ReactRedux.useDispatch(),c=ReactRedux.useDispatch(),{index:d,config:o,TRIGGER:a}=it(f=>({index:f.DB[K.index],config:f.DB[K.config],TRIGGER:f.DB[K.TRIGGER]})),l=React.useCallback(()=>a?(at(a),Promise.resolve()):mn(n),[a,n]);cs(()=>{ee(l)});const h=vs(f=>f.AppBarTitle[ct.title]),[p,y]=React.useState(null),[x,S]=React.useState(!1),j=()=>{S(!1)},k=!!p,{setMenuToggle:R,...P}=t,O=React.useContext(Te),[F,T]=React.useState(!1),{subtitle:v,id:m}=nt();return e.jsxs(React.StrictMode,{children:[e.jsxs(Ft,{position:"sticky",className:W.AppBar??"",...P,children:[e.jsx(qt,{onClick:O?R:T.bind(null,!0),className:W.menuIcon??"",size:"large",children:e.jsx(Ut,{})}),e.jsx("span",{onClick:()=>{l().then(()=>{const $=prompt("运行单条SQL代码")?.trim();$&&te.transaction(U=>{U.executeSql($,[])},U=>{c({type:w.OPENTRUE,payload:{[E.alertText]:`执行失败, 原因:${U.message}`,[E.severity]:B.error}})},()=>{c({type:w.OPENTRUE,payload:{[E.alertText]:`${$}
+执行成功`,[E.severity]:B.success}})})})},children:(h||m)??ue}),e.jsxs(N,{className:classNames(W.Avatar,{[W.open??""]:k}),onClick:f=>{y(f.currentTarget)},children:[e.jsx(Qt,{}),e.jsx("span",{children:"HJX, HJX"}),e.jsx(Ht,{})]})]}),e.jsxs(zt,{anchorEl:p,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},open:k,onClose:()=>{y(null)},className:W.Popover??"",children:[v===o?.[0]?.path&&e.jsx(tt,{control:e.jsx(Wt,{}),label:"索引",onChange:(f,$)=>{n({type:de.SET,payload:{index:$}})},checked:d??!1}),m&&e.jsxs(mt,{fullWidth:!0,onClick:()=>ReactDOM.unstable_batchedUpdates(()=>{y(null),S(!0)}),children:["重置",m,"表"]}),e.jsx(N,{fullWidth:!0,onClick:()=>{confirm("确定要删库跑路吗?")&&o?.map(f=>f.children).flat().forEach(f=>{Xe(f,c,`删${f}库跑路成功! 5秒后自动刷新`)}),j()},color:"error",variant:"outlined",children:"删库跑路"})]}),e.jsx(hn,{open:x,handleClose:j,title:`确定要重置${m}表吗?`,onClick:()=>{pn(),localStorage.clear(),Xe(m??"",c,`重置${m}表成功! 5秒后自动刷新`),j()}}),e.jsx(Gt,{anchor:"left",open:!O&&F,onClose:T.bind(null,!1),children:e.jsx(Se,{})})]})}const xn="_MainFrame_jou1o_1",gn={MainFrame:xn};function yn(){const[t,{toggle:n}]=is(!0),c=React.useContext(Te);return e.jsxs(React.StrictMode,{children:[e.jsx(fn,{setMenuToggle:n}),e.jsxs("div",{className:gn.MainFrame,style:{"--gap":t?"9q":0},children:[e.jsx(et,{in:t&&c,orientation:"horizontal",children:e.jsx(I,{elevation:24,children:e.jsx(Se,{})})}),e.jsx("div",{children:e.jsx(ts,{})})]})]})}const ft=React.lazy(()=>us(()=>Promise.resolve().then(()=>zs),void 0,import.meta.url)),jn=[{path:"",id:"目录",element:e.jsx(React.Suspense,{fallback:e.jsx(ve,{}),children:e.jsx(ft,{})})}],xt=(...t)=>`/${t.join("/")}`;function vn(){return e.jsx(ss,{children:e.jsxs(xe,{element:e.jsx(yn,{}),children:[e.jsx(xe,{index:!0,element:e.jsx(React.Suspense,{fallback:e.jsx(Ye,{open:!0,children:e.jsx(ve,{})}),children:e.jsx(ft,{})})}),e.jsx(xe,{path:":subtitle/:id",element:e.jsx(dn,{})})]})})}const Sn=Redux.combineReducers({SnackBar:sn,AppBarTitle:js,DB:$s}),gt=Redux.legacy_createStore(Sn,Redux.applyMiddleware(ReduxThunk));gt.subscribe(()=>{});const Tn="_Snackbar_1t4e7_1",Rn={Snackbar:Tn};function bn(){const{open:t,alertText:n,severity:c}=ut(a=>({open:a.SnackBar.open,alertText:a.SnackBar.alertText,severity:a.SnackBar.severity})),d=ReactRedux.useDispatch(),o=(a,l)=>{l!=="clickaway"&&d({type:w.OPENFALSE})};return e.jsx(React.StrictMode,{children:e.jsx(Xt,{open:!!(t&&n),autoHideDuration:6e3,onClose:o,message:n,className:Rn.Snackbar??"",children:e.jsx(st,{onClose:o,severity:c,variant:"filled",children:n})})})}const yt={loadingDelay:300,throttleWait:300},Te=React.createContext(!1),En=()=>{const t=Yt("(orientation:landscape)");return e.jsx(React.StrictMode,{children:e.jsx(Ze,{injectFirst:!0,children:e.jsxs(Zt,{children:[e.jsx(es,{}),e.jsx(ReactRedux.Provider,{store:gt,children:e.jsxs(Te.Provider,{value:t,children:[e.jsx(os,{children:e.jsx(vn,{})}),e.jsx(bn,{})]})})]})})})};ReactDOM.render(e.jsx(React.StrictMode,{children:e.jsx(En,{})}),document.body);
+function __vite__mapDeps(indexes) {
+ if (!__vite__mapDeps.viteFileDeps) {
+ __vite__mapDeps.viteFileDeps = []
+ }
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
+}