lantern-harness 0.1.43 → 0.1.45
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/CHANGELOG.md +36 -0
- package/README.md +1 -1
- package/builtin/session/lh-nav-groups.mjs +18 -4
- package/dist/500.html +61 -5
- package/dist/_astro/Base.Bkt1lrgu.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.Chv7r8_9.js → Base.astro_astro_type_script_index_0_lang.UKTVQqk7.js} +1 -1
- package/dist/_astro/{CaseExecBoard.DUMjSunb.js → CaseExecBoard.DICluCbK.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.DtuOyQuv.js → CaseGenerateApp.Be3h5XPG.js} +1 -1
- package/dist/_astro/{CasesLibrary.B9o_jvXb.js → CasesLibrary.Buys7Cy-.js} +3 -3
- package/dist/_astro/ChatApp.D3BheKci.js +227 -0
- package/dist/_astro/ConfirmDialog.DrrPf1MB.js +1 -0
- package/dist/_astro/{DashboardBoard.DEvgMoqo.js → DashboardBoard.Qvf8o4v1.js} +1 -1
- package/dist/_astro/{DocsFileBrowser.D66pN9rp.js → DocsFileBrowser.DwKBffbM.js} +1 -1
- package/dist/_astro/{DocsPager.ceBEecmd.js → DocsPager.Duf4I68E.js} +1 -1
- package/dist/_astro/{DrawerField.CWpOf3L_.js → DrawerField.BH3p4Q4D.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.DYqE2mRi.js → KnowledgeLibrary.MDpMqeOd.js} +1 -1
- package/dist/_astro/{LifeKrTasksBoard.B7UiEutA.js → LifeKrTasksBoard.DsvW_S66.js} +1 -1
- package/dist/_astro/{LifeKrTodosBoard.VL7HdhNY.js → LifeKrTodosBoard.D2KTqvg1.js} +1 -1
- package/dist/_astro/{LifeObjectivesBoard.lLBPOHEZ.js → LifeObjectivesBoard.B0cDK934.js} +1 -1
- package/dist/_astro/{LifePlanTypeSelect.CdKQmlEK.js → LifePlanTypeSelect.BELDvMWU.js} +1 -1
- package/dist/_astro/{LifeReviewsBoard.AjO4SbsR.js → LifeReviewsBoard.BPXeVpg1.js} +1 -1
- package/dist/_astro/{LifeShared.CtdsQI43.js → LifeShared.tnT7aQON.js} +1 -1
- package/dist/_astro/{LifeStagesBoard.Dl-kTZ6K.js → LifeStagesBoard.CZftLR9K.js} +1 -1
- package/dist/_astro/{LifeYearCycleSelect.BILJOKXK.js → LifeYearCycleSelect.Bw2eRbSm.js} +1 -1
- package/dist/_astro/{LifeYearPlansBoard.BzJmi7Hw.js → LifeYearPlansBoard.DB-RJFEl.js} +1 -1
- package/dist/_astro/{MultiSelectDropdown.y8JMbCxO.js → MultiSelectDropdown.CBC7aNOv.js} +1 -1
- package/dist/_astro/NavLibraries.DdQYsZbe.js +1 -0
- package/dist/_astro/OverflowHint.CHZeFfUj.js +1 -0
- package/dist/_astro/{PluginsPage.D2OrUGY3.js → PluginsPage.C1JnInH4.js} +1 -1
- package/dist/_astro/PluginsPage.C3eEwy3K.js +1 -0
- package/dist/_astro/{PmBugsBoard.BynUocbE.js → PmBugsBoard.CGpXUTPu.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.CvFblvfX.js → PmIterationsBoard.BaKiFIam.js} +1 -1
- package/dist/_astro/{PmProjectDetail.Dlm6flwk.js → PmProjectDetail.DneFVBpy.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.B5vaWuax.js → PmProjectsBoard.BxoMF9gK.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.-SI8VZXI.js +1 -0
- package/dist/_astro/{PmRequirementsBoard.piRWjiYA.js → PmRequirementsBoard.DsK6RF7Q.js} +1 -1
- package/dist/_astro/PmShared.BK8kWRSV.js +1 -0
- package/dist/_astro/{PromptMountDialog.DYojFMok.js → PromptMountDialog.mrTx3U5T.js} +1 -1
- package/dist/_astro/PromptsLibrary.B_SUf47p.js +1 -0
- package/dist/_astro/{ReportsPage.B-xhGVEU.js → ReportsPage.B9lGg1_s.js} +1 -1
- package/dist/_astro/{ReqAnalysisBoard.B3sAOuAq.js → ReqAnalysisBoard.CIZKnCQH.js} +1 -1
- package/dist/_astro/{RequirementsLibrary.BGys7DeN.js → RequirementsLibrary.cJc-bnGQ.js} +1 -1
- package/dist/_astro/{SearchableSelect.DFZBUFIs.js → SearchableSelect.SyLRS-Jj.js} +1 -1
- package/dist/_astro/SelectDropdown.T3CKHaLt.js +1 -0
- package/dist/_astro/{SettingsDialog.CEyjZuxq.js → SettingsDialog.DYdtCvLc.js} +1 -1
- package/dist/_astro/{SpaceSwitcher.DJqvw5Lw.js → SpaceSwitcher.C47_S1g9.js} +1 -1
- package/dist/_astro/{TableFieldConfig.D0v9S2g3.js → TableFieldConfig.C7O-mL-p.js} +1 -1
- package/dist/_astro/{TasksBoard.DZ9LLl_c.js → TasksBoard.BUEg2BYk.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.iyj_kFMO.js → TemplatesLibrary.BLVIphXO.js} +1 -1
- package/dist/_astro/{TestReportsLibrary.B6pf0d7W.js → TestReportsLibrary.DVq30Jae.js} +1 -1
- package/dist/_astro/{TestStatsBoard.DS_2bqWI.js → TestStatsBoard.-5BWQ6bI.js} +1 -1
- package/dist/_astro/{TodosBoard.CYAVDD1W.js → TodosBoard.DI_lTp2e.js} +1 -1
- package/dist/_astro/UiAutoBoard.ChFdgv7s.js +2 -0
- package/dist/_astro/UiAutoEnvPanel.B50q4kYb.js +19 -0
- package/dist/_astro/UiAutoGenerationDialog.CLkFAHrm.js +1 -0
- package/dist/_astro/UiAutoProjectsPage.DCsDeN5d.js +3 -0
- package/dist/_astro/app-config.DkyjuL-S.js +1 -0
- package/dist/_astro/app-version.Cy-5oZO2.js +1 -0
- package/dist/_astro/{bash-tools.CfNj2sh0.js → bash-tools.D9HCzC_7.js} +1 -1
- package/dist/_astro/{case-gen-run.nrr97yK3.js → case-gen-run.BklG1H8k.js} +1 -1
- package/dist/_astro/{case-types.B51yDRdf.js → case-types.DlFkbZJN.js} +1 -1
- package/dist/_astro/composer-draft.llpvz3MW.js +1 -0
- package/dist/_astro/composer-task.DRi5tAJs.js +5 -0
- package/dist/_astro/{hydrate-cache.CoD1FB3T.js → hydrate-cache.B15Nrpq0.js} +1 -1
- package/dist/_astro/i18n.D_aOCHSN.js +7 -0
- package/dist/_astro/{open-docs-in-session.DJtuI1C4.js → open-docs-in-session.CRiZT022.js} +1 -1
- package/dist/_astro/plugins.BRvXWHLe.js +1 -0
- package/dist/_astro/prompts-meta.BUGutlsk.js +2 -0
- package/dist/_astro/{req-analysis.qmyv5cBw.js → req-analysis.B12_MGMQ.js} +1 -1
- package/dist/_astro/{settings.CYERib3l.js → settings.38J2uD5M.js} +2 -2
- package/dist/_astro/{spaces-client.DvIgFink.js → spaces-client.DV04tRyD.js} +1 -1
- package/dist/_astro/{story-review.2UUlN3p-.js → story-review.D2W5tEOY.js} +1 -1
- package/dist/_astro/{test-reports.DPQ-FMsQ.js → test-reports.CuIjlEyK.js} +1 -1
- package/dist/_astro/ui-auto-prompt.H9_yhau9.js +9 -0
- package/dist/_astro/ui-auto.DMv940x4.js +1 -0
- package/dist/_astro/{view-prefs.GnvelRDj.js → view-prefs.DhdLZjGh.js} +1 -1
- package/dist/case-exec/index.html +62 -6
- package/dist/cases/generate/index.html +62 -6
- package/dist/cases/library/index.html +62 -6
- package/dist/dashboard/index.html +62 -6
- package/dist/docs/changelog/index.html +138 -50
- package/dist/docs/install/index.html +61 -5
- package/dist/docs/manual/index.html +129 -21
- package/dist/knowledge/index.html +62 -6
- package/dist/life/kr-tasks/index.html +62 -6
- package/dist/life/kr-todos/index.html +62 -6
- package/dist/life/objectives/index.html +62 -6
- package/dist/life/reviews/index.html +62 -6
- package/dist/life/stages/index.html +62 -6
- package/dist/life/year-plans/index.html +62 -6
- package/dist/plugins/index.html +62 -6
- package/dist/pm/bugs/index.html +62 -6
- package/dist/pm/iterations/index.html +62 -6
- package/dist/pm/projects/detail/index.html +62 -6
- package/dist/pm/projects/index.html +62 -6
- package/dist/pm/requirements/index.html +62 -6
- package/dist/prompts/index.html +62 -6
- package/dist/reports/index.html +62 -6
- package/dist/requirement-analysis/index.html +62 -6
- package/dist/requirements/index.html +62 -6
- package/dist/tasks/index.html +62 -6
- package/dist/templates/index.html +62 -6
- package/dist/test-automation/index.html +63 -7
- package/dist/test-automation/projects/index.html +980 -0
- package/dist/test-reports/index.html +62 -6
- package/dist/test-stats/index.html +62 -6
- package/dist/todos/index.html +62 -6
- package/dist/workbench/index.html +62 -6
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +1 -1
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +107 -63
- package/lh-plugins/lh-uiauto.mjs +2502 -51
- package/lh-plugins/plugin-prompts.mjs +62 -2
- package/lh-plugins/storage-domain.mjs +17 -4
- package/lh-plugins/uiauto-adapters/playwright.mjs +29 -14
- package/lh-plugins/uiauto-adapters/tasks.mjs +8 -2
- package/lh-plugins/uiauto-env.mjs +669 -0
- package/lh-plugins/uiauto-explorer/apps.mjs +4 -5
- package/lh-plugins/uiauto-explorer/emit-files.mjs +32 -9
- package/lh-plugins/uiauto-explorer/emit-ts.mjs +13 -2
- package/lh-plugins/uiauto-explorer/ir.mjs +20 -0
- package/lh-plugins/uiauto-explorer/sessions.mjs +36 -0
- package/lh-plugins/uiauto-node.mjs +327 -0
- package/lh-plugins/uiauto-pm.mjs +178 -0
- package/lh-plugins/uiauto-prompt.mjs +228 -18
- package/lh-plugins/uiauto-report.mjs +16 -0
- package/lh-plugins/uiauto-scaffold/audit.mjs +356 -0
- package/lh-plugins/uiauto-scaffold/index.mjs +25 -0
- package/lh-plugins/uiauto-scaffold/library.mjs +508 -0
- package/lh-plugins/uiauto-scaffold/manifest.mjs +83 -0
- package/lh-plugins/uiauto-scaffold/render.mjs +133 -0
- package/lh-plugins/uiauto-scaffold/templates/playwright-ts.json +225 -0
- package/lh-plugins/uiauto-scaffold/templates/playwright-ts.mjs +46 -0
- package/package.json +1 -1
- package/dist/_astro/Base.BnVp5Mf8.css +0 -1
- package/dist/_astro/ChatApp.CKPGFibd.js +0 -227
- package/dist/_astro/ConfirmDialog.D5qXeML0.js +0 -1
- package/dist/_astro/NavLibraries.BnaL-km5.js +0 -1
- package/dist/_astro/OverflowHint.pvo2Xc8R.js +0 -1
- package/dist/_astro/PluginsPage.CMW4hEFr.js +0 -1
- package/dist/_astro/PmRequirementsBoard.B8KTeso8.js +0 -1
- package/dist/_astro/PmShared.86HEsdd_.js +0 -1
- package/dist/_astro/PromptsLibrary.GpNbBTj1.js +0 -1
- package/dist/_astro/SelectDropdown.Dmk5n225.js +0 -1
- package/dist/_astro/SlideOverDrawer.C1IVOc_8.js +0 -1
- package/dist/_astro/UiAutoBoard.DSsiMfx2.js +0 -9
- package/dist/_astro/app-config.DwpFFa5D.js +0 -1
- package/dist/_astro/app-version.Dabxyva-.js +0 -1
- package/dist/_astro/composer-task.DJmluzPT.js +0 -5
- package/dist/_astro/i18n.vo2aElR9.js +0 -7
- package/dist/_astro/plugins.BmKRnp4a.js +0 -1
- package/dist/_astro/prompts-meta.bF2q5SUy.js +0 -2
- package/dist/_astro/ui-auto-prompt.COBTt5Gd.js +0 -4
- package/dist/_astro/ui-auto.BmC9JJ_X.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.DwpFFa5D.js";import{s as r}from"./plugins.BmKRnp4a.js";import{t as i}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.D5qXeML0.js";import{n as te,t as ne}from"./DocsPager.ceBEecmd.js";import{t as a}from"./SelectDropdown.Dmk5n225.js";import{A as re,D as ie,N as ae,P as oe,R as o,b as se,g as ce,h as le,i as ue,j as de,m as s,n as fe,p as pe,r as c,t as l,x as me,z as he}from"./pm.BXmOiFfW.js";import{A as ge,C as _e,D as ve,E as u,O as ye,S as be,_ as d,a as xe,c as Se,d as Ce,f,g as we,h as Te,j as Ee,k as p,l as De,m,n as Oe,p as ke,s as Ae,t as je,u as Me,y as h}from"./PmShared.86HEsdd_.js";import{n as Ne,r as Pe,t as Fe}from"./TableFieldConfig.D0v9S2g3.js";import{showToast as g}from"./Toast.BO2NFckG.js";import{c as Ie,d as Le,i as Re,l as ze,n as Be,o as Ve,r as He,s as Ue,t as _}from"./ColumnResize.CkE59sGq.js";var v=e(t(),1),y=i(),b=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`severity`,width:100,min:80},{key:`status`,width:120,min:96}],We={key:`project`,width:140,min:100},Ge=[{key:`iteration`,width:120,min:88},{key:`createdAt`,width:140,min:110},{key:`updatedAt`,width:140,min:110},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],Ke=new Set([`id`,`title`,`filler`,`action`]),qe=[{key:`severity`,label:`严重程度`},{key:`status`,label:`缺陷状态`},{key:`iteration`,label:`所属迭代`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Je=`pm.bugs.fields`,Ye=20,Xe=`tw.pm-bugs.page-size.v1`,Ze=[`all`,...c],Qe=[`all`,...l],$e=`pm.bugs.project`,et=`pm.bugs.iteration`,tt=`pm.bugs.status`,nt=`pm.bugs.severity`,rt=`pm.bugs.keyword`,it=l.map(e=>({value:e,label:fe[e]})),at=c.map(e=>({value:e,label:ue[e]}));function x(e=``){return{projectId:e,iterationId:``,requirementId:``,title:``,severity:`minor`,status:`pending`,reproduceSteps:``,expectedResult:``,actualResult:``,environment:``,githubIssue:``,attachment:``,remark:``}}function S(){return n(`pm.bugs.create-draft.v1`)}function ot(e){return!!(e.reproduceSteps.trim()||e.attachment.trim()||e.remark.trim()||e.iterationId||e.requirementId||e.expectedResult.trim()||e.actualResult.trim()||e.environment.trim()||e.githubIssue.trim())}function C(){try{let e=sessionStorage.getItem(S());if(!e)return null;let t=JSON.parse(e);return!t||typeof t!=`object`||t.id?null:{...x(),...t,id:void 0}}catch{return null}}function w(e){try{let t=S();if(!e||e.id||!ot(e)){sessionStorage.removeItem(t);return}sessionStorage.setItem(t,JSON.stringify({...e,id:void 0}))}catch{}}function st(e){let t=C();return t?e&&t.projectId!==e?{...t,projectId:e,iterationId:``,requirementId:``}:t:x(e)}function T({scopeProjectId:e=``}={}){let t=!!e,n=ge(`bugs`),{store:i,live:c,loading:l,error:x,setError:S,reload:C}=Ee(),[T,E]=p($e,`all`),D=e||T,[O,k]=p(et,`all`),[A,ct]=ye(tt,Ze,`all`),[j,lt]=ye(nt,Qe,`all`),[M,ut]=p(rt),[dt,N]=(0,v.useState)(1),[P,ft]=te(Ye,Xe),[F,I]=(0,v.useState)(null),[L,R]=(0,v.useState)(!1),[z,pt]=(0,v.useState)(!1),B=(0,v.useRef)(null),V=(0,v.useRef)(new Set),[H,U]=(0,v.useState)(null),[mt,W]=(0,v.useState)(null),G=(0,v.useMemo)(()=>de(F?.attachment??``),[F?.attachment]),ht=(0,v.useMemo)(()=>t?qe:[{key:`project`,label:`所属项目`},...qe],[t]),K=Pe(Je,ht,Ke),gt=(0,v.useMemo)(()=>t?[...b,...Ge]:[...b,We,...Ge],[t]),q=(0,v.useMemo)(()=>Ne(gt,K.isVisible),[gt,K.isVisible]),J=ze(t?`pm.bugs.cols.scoped.v2`:`pm.bugs.cols.v2`,q),_t=Le(t?`pm.bugs.scroll.scoped`:`pm.bugs.scroll`),vt=J.widthOf(`id`)??88;(0,v.useEffect)(()=>{for(let e of G)V.current.add(e.url)},[G]);let yt=(0,v.useMemo)(()=>[{value:`all`,label:`全部项目`},...i.projects.map(e=>({value:e.id,label:e.name}))],[i.projects]),bt=(0,v.useMemo)(()=>[{value:`all`,label:`全部迭代`},...i.iterations.filter(e=>D===`all`||e.projectId===D).map(e=>({value:e.id,label:e.name}))],[i.iterations,D]),xt=(0,v.useMemo)(()=>{let e=new Map(i.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[i.projects]),St=(0,v.useMemo)(()=>{let e=new Map(i.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[i.iterations]),Y=(0,v.useMemo)(()=>ae(me(i.bugs,{projectId:D,iterationId:O,status:A,severity:j,keyword:M})),[i.bugs,D,O,A,j,M]),X=t?i.bugs.filter(e=>e.projectId===D).length:i.bugs.length,Ct=Math.max(1,Math.ceil(Y.length/P)),Z=Math.min(dt,Ct),wt=Y.slice((Z-1)*P,Z*P);(0,v.useEffect)(()=>{t||c===!0&&T!==`all`&&!i.projects.some(e=>e.id===T)&&E(`all`)},[c,i.projects,T,E,t]),(0,v.useEffect)(()=>{c===!0&&O!==`all`&&!i.iterations.some(e=>e.id===O&&(D===`all`||e.projectId===D))&&k(`all`)},[c,i.iterations,D,O,k]);let Tt=F?oe(i.iterations.filter(e=>e.projectId===F.projectId)):[],Et=F?i.requirements.filter(e=>e.projectId===F.projectId):[];async function Dt(){if(!F)return;if(!F.projectId){S(`请先选择所属项目`);return}let e=F.reproduceSteps.trim();if(!e){S(`缺陷描述不能为空`);return}let t=pe(e);R(!0);try{let n={projectId:F.projectId,iterationId:F.iterationId,requirementId:F.requirementId,title:t,severity:F.severity,status:F.status,reproduceSteps:e,expectedResult:F.expectedResult,actualResult:F.actualResult,environment:F.environment,githubIssue:F.githubIssue,attachment:F.attachment,remark:F.remark};F.id?await o(`bugs`,F.id,n):await le(`bugs`,[n]);let r=!!F.id;r||w(null),I(null),V.current.clear(),S(``),await C(!0),g(r?`已保存缺陷`:`已新建缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);S(t),g(`保存缺陷失败:${t}`,`error`)}finally{R(!1)}}let Q=(0,v.useCallback)(async e=>{if(e&&e.length){pt(!0);try{let t=await he(Array.from(e));I(e=>{if(!e)return e;let n=de(e.attachment);return{...e,attachment:re([...n,...t])}}),S(``)}catch(e){S(e instanceof Error?e.message:String(e))}finally{pt(!1),B.current&&(B.current.value=``)}}},[S]),Ot=F!==null;(0,v.useEffect)(()=>{if(!Ot)return;let e=e=>{let t=se(e.clipboardData);t.length&&(e.preventDefault(),Q(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[Ot,Q]);async function kt(e){if(!F)return;let t=re(G.filter(t=>t.url!==e));if(F.id)try{await o(`bugs`,F.id,{attachment:t}),await C(!0)}catch(e){S(e instanceof Error?e.message:String(e));return}I(e=>{if(!e)return e;let n={...e,attachment:t};return n.id||w(n),n}),s([e],F.id??``)}function At(){if(F&&!F.id){if(w(F),V.current.clear(),I(null),!ot(F)){let e=G.map(e=>e.url);e.length&&s(e)}return}let e=[...V.current,...G.map(e=>e.url)];V.current.clear(),I(null),e.length&&s(e)}function $(){I(st(D===`all`?``:D))}async function jt(e,t){R(!0);try{await o(`bugs`,e.id,{status:t}),await C(!0)}catch(e){S(e instanceof Error?e.message:String(e))}finally{R(!1)}}async function Mt(){let e=H;if(e){U(null),R(!0);try{await ce(`bugs`,[e.id]),await C(!0),g(`已删除缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);S(t),g(`删除缺陷失败:${t}`,`error`)}finally{R(!1)}}}if(!n.ready)return(0,y.jsx)(we,{label:`正在读取插件开关`});if(!n.on)return(0,y.jsx)(d,{children:r(`bugs`)});if(c===null)return(0,y.jsx)(we,{label:`正在连接项目管理服务`});if(!c)return(0,y.jsx)(d,{children:`缺陷管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(i.projects.length===0&&!l&&!t)return(0,y.jsx)(d,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来记录缺陷。`});let Nt=[{value:`all`,label:`全部`},...at];return(0,y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,y.jsx)(`span`,{className:`font-medium text-stone-600`,children:X}),` 条缺陷`,Y.length===X?``:` · 筛选出 ${Y.length} 条`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,y.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选缺陷`,className:`w-36`,options:yt,value:T,onChange:e=>{E(e),k(`all`),N(1)}}),(0,y.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选缺陷`,className:`w-32`,options:bt,value:O,onChange:e=>{k(e),N(1)}}),(0,y.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按严重程度筛选缺陷`,className:`w-32`,options:[{value:`all`,label:`全部严重程度`},...it],value:j,onChange:e=>{lt(e),N(1)}}),(0,y.jsxs)(`label`,{className:`relative block`,children:[(0,y.jsx)(m,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,y.jsx)(`input`,{value:M,onChange:e=>{ut(e.target.value),N(1)},placeholder:`搜索编号 / 标题…`,className:`h-9 w-48 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,y.jsx)(Fe,{fields:K.fields,isVisible:K.isVisible,onToggle:K.toggle}),(0,y.jsxs)(`button`,{type:`button`,disabled:L,onClick:$,className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,y.jsx)(m,{name:`plus`,size:14}),`新建缺陷`]})]})]}),(0,y.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,y.jsx)(ke,{ariaLabel:`按状态筛选缺陷`,options:Nt,value:A,onChange:e=>{ct(e),N(1)}})}),x?(0,y.jsx)(Ce,{message:x,onClose:()=>S(``)}):null,(0,y.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,y.jsx)(`div`,{ref:_t,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,y.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:J.tableStyle,children:[(0,y.jsx)(`colgroup`,{children:q.map(e=>(0,y.jsx)(`col`,{style:J.widthOf(e.key)?{width:J.widthOf(e.key)}:void 0},e.key))}),(0,y.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,y.jsxs)(`tr`,{children:[(0,y.jsxs)(`th`,{className:`${Ue} relative`,children:[`ID`,(0,y.jsx)(_,{...J.resizeProps(`id`)})]}),(0,y.jsxs)(`th`,{className:Ve,style:{"--tw-sticky-left":`${vt}px`},children:[`缺陷标题`,(0,y.jsx)(_,{...J.resizeProps(`title`)})]}),K.isVisible(`severity`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`严重程度`,(0,y.jsx)(_,{...J.resizeProps(`severity`)})]}):null,K.isVisible(`status`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`缺陷状态`,(0,y.jsx)(_,{...J.resizeProps(`status`)})]}):null,!t&&K.isVisible(`project`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,y.jsx)(_,{...J.resizeProps(`project`)})]}):null,K.isVisible(`iteration`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,y.jsx)(_,{...J.resizeProps(`iteration`)})]}):null,K.isVisible(`createdAt`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`创建日期`,(0,y.jsx)(_,{...J.resizeProps(`createdAt`)})]}):null,K.isVisible(`updatedAt`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`修改日期`,(0,y.jsx)(_,{...J.resizeProps(`updatedAt`)})]}):null,(0,y.jsx)(`th`,{"aria-hidden":`true`}),(0,y.jsx)(`th`,{className:Ie,children:`操作`})]})}),(0,y.jsxs)(`tbody`,{children:[l&&!i.bugs.length?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:q.length,className:`px-4 py-16 text-center`,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):wt.length===0?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:q.length,children:X?(0,y.jsx)(De,{children:`没有符合筛选条件的缺陷。`}):(0,y.jsx)(Me,{icon:`bug`,title:`暂无缺陷`,hint:`记录第一个缺陷,跟踪严重程度与修复状态。`,action:(0,y.jsxs)(`button`,{type:`button`,onClick:$,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,y.jsx)(m,{name:`plus`,size:13}),`新建缺陷`]})})})}):null,wt.map(e=>(0,y.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,y.jsx)(`td`,{className:`${He} font-mono text-xs text-stone-400`,children:e.autoId}),(0,y.jsx)(`td`,{className:Be,style:{"--tw-sticky-left":`${vt}px`},children:(0,y.jsx)(_e,{text:e.title,onClick:()=>I({id:e.id,projectId:e.projectId,iterationId:e.iterationId,requirementId:e.requirementId,title:e.title,severity:e.severity,status:e.status,reproduceSteps:e.reproduceSteps||e.title,expectedResult:e.expectedResult,actualResult:e.actualResult,environment:e.environment,githubIssue:e.githubIssue,attachment:e.attachment,remark:e.remark})})}),K.isVisible(`severity`)?(0,y.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,y.jsx)(be,{tone:je[e.severity],children:fe[e.severity]})}):null,K.isVisible(`status`)?(0,y.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,y.jsx)(a,{unstyled:!0,fitContent:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:L,options:at,value:e.status,onChange:t=>void jt(e,t),renderOptionPrefix:e=>(0,y.jsx)(Ae,{tone:Oe[e.value]}),renderTrigger:()=>(0,y.jsx)(be,{tone:Oe[e.status],children:ue[e.status]})})}):null,!t&&K.isVisible(`project`)?(0,y.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,y.jsx)(`a`,{href:ve(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:xt(e.projectId)})}):null,K.isVisible(`iteration`)?(0,y.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:St(e.iterationId)}):null,K.isVisible(`createdAt`)?(0,y.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:u(e.createdAt)}):null,K.isVisible(`updatedAt`)?(0,y.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:u(e.updatedAt)}):null,(0,y.jsx)(`td`,{"aria-hidden":`true`}),(0,y.jsx)(`td`,{className:Re,children:(0,y.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:L,onClick:()=>U(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,y.jsx)(m,{name:`trash`,size:15})})})]},e.id))]})]})}),Y.length>0?(0,y.jsx)(ne,{page:Z,totalPages:Ct,pageSize:P,busy:L,onPage:N,onPageSize:e=>{ft(e),N(1)}}):null]}),(0,y.jsx)(Se,{open:F!==null,title:F?.id?`编辑缺陷`:`新建缺陷`,busy:L,submitLabel:F?.id?`保存`:`创建`,onClose:At,onSubmit:()=>void Dt(),children:F?(0,y.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,y.jsx)(f,{label:`所属项目`,required:!0,children:(0,y.jsx)(h,{ariaLabel:`所属项目`,options:i.projects.map(e=>({value:e.id,label:e.name})),value:F.projectId,onChange:e=>I({...F,projectId:e,iterationId:``,requirementId:``})})}),(0,y.jsx)(f,{label:`所属迭代`,children:(0,y.jsx)(h,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...Tt.map(e=>({value:e.id,label:e.name}))],value:F.iterationId,onChange:e=>I({...F,iterationId:e}),disabled:Tt.length===0})}),(0,y.jsx)(f,{label:`关联需求`,children:(0,y.jsx)(h,{ariaLabel:`关联需求`,options:[{value:``,label:`不关联需求`},...Et.map(e=>({value:e.id,label:`${e.autoId} ${e.title}`}))],value:F.requirementId,onChange:e=>I({...F,requirementId:e}),disabled:Et.length===0})}),(0,y.jsx)(f,{label:`缺陷描述`,required:!0,children:(0,y.jsx)(`textarea`,{autoFocus:!0,value:F.reproduceSteps,onChange:e=>I({...F,reproduceSteps:e.target.value}),placeholder:`描述问题现象、复现步骤与影响范围`,rows:5,className:xe})}),(0,y.jsx)(f,{label:`严重程度`,children:(0,y.jsx)(h,{ariaLabel:`严重程度`,options:it,value:F.severity,onChange:e=>I({...F,severity:e}),renderOptionPrefix:e=>(0,y.jsx)(Ae,{tone:je[e.value]})})}),(0,y.jsx)(f,{label:`附件`,children:(0,y.jsxs)(`div`,{className:`space-y-2`,children:[G.length?(0,y.jsx)(`ul`,{className:`space-y-1.5`,children:G.map(e=>{let t=ie(e.url);return(0,y.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>W(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,y.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,y.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,y.jsx)(m,{name:`file`,size:15})}),t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>W(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>kt(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url)})}):null,(0,y.jsx)(`input`,{ref:B,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void Q(e.target.files)}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`button`,{type:`button`,disabled:z,onClick:()=>B.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,y.jsx)(m,{name:z?`file`:`plus`,size:13}),z?`上传中…`:`上传文件 / 图片`]}),(0,y.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可直接粘贴截图 / 图片(⌘V / Ctrl+V),支持多张`})]})]})}),(0,y.jsx)(f,{label:`备注`,children:(0,y.jsx)(`textarea`,{value:F.remark,onChange:e=>I({...F,remark:e.target.value}),rows:2,className:xe})}),F.id?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f,{label:`创建日期`,children:(0,y.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:u(i.bugs.find(e=>e.id===F.id)?.createdAt)})}),(0,y.jsx)(f,{label:`修改日期`,children:(0,y.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:u(i.bugs.find(e=>e.id===F.id)?.updatedAt)})})]}):null]}):null}),(0,y.jsx)(ee,{open:H!==null,title:`删除缺陷`,message:`确定删除「${H?.title??``}」?此操作无法恢复。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>U(null),onConfirm:()=>void Mt()}),(0,y.jsx)(Te,{file:mt,onClose:()=>W(null)})]})}export{T as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.DkyjuL-S.js";import{s as r}from"./plugins.BRvXWHLe.js";import{t as i}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.DrrPf1MB.js";import{n as te,t as ne}from"./DocsPager.Duf4I68E.js";import{t as a}from"./SelectDropdown.T3CKHaLt.js";import{A as re,D as ie,N as ae,P as oe,R as o,b as se,g as ce,h as le,i as ue,j as de,m as s,n as fe,p as pe,r as c,t as l,x as me,z as he}from"./pm.BXmOiFfW.js";import{A as ge,C as _e,D as ve,E as u,O as ye,S as be,_ as d,a as xe,c as Se,d as Ce,f,g as we,h as Te,j as Ee,k as p,l as De,m,n as Oe,p as ke,s as Ae,t as je,u as Me,y as h}from"./PmShared.BK8kWRSV.js";import{n as Ne,r as Pe,t as Fe}from"./TableFieldConfig.C7O-mL-p.js";import{showToast as g}from"./Toast.BO2NFckG.js";import{c as Ie,d as Le,i as Re,l as ze,n as Be,o as Ve,r as He,s as Ue,t as _}from"./ColumnResize.CkE59sGq.js";var v=e(t(),1),y=i(),b=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`severity`,width:100,min:80},{key:`status`,width:120,min:96}],We={key:`project`,width:140,min:100},Ge=[{key:`iteration`,width:120,min:88},{key:`createdAt`,width:140,min:110},{key:`updatedAt`,width:140,min:110},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],Ke=new Set([`id`,`title`,`filler`,`action`]),qe=[{key:`severity`,label:`严重程度`},{key:`status`,label:`缺陷状态`},{key:`iteration`,label:`所属迭代`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Je=`pm.bugs.fields`,Ye=20,Xe=`tw.pm-bugs.page-size.v1`,Ze=[`all`,...c],Qe=[`all`,...l],$e=`pm.bugs.project`,et=`pm.bugs.iteration`,tt=`pm.bugs.status`,nt=`pm.bugs.severity`,rt=`pm.bugs.keyword`,it=l.map(e=>({value:e,label:fe[e]})),at=c.map(e=>({value:e,label:ue[e]}));function x(e=``){return{projectId:e,iterationId:``,requirementId:``,title:``,severity:`minor`,status:`pending`,reproduceSteps:``,expectedResult:``,actualResult:``,environment:``,githubIssue:``,attachment:``,remark:``}}function S(){return n(`pm.bugs.create-draft.v1`)}function ot(e){return!!(e.reproduceSteps.trim()||e.attachment.trim()||e.remark.trim()||e.iterationId||e.requirementId||e.expectedResult.trim()||e.actualResult.trim()||e.environment.trim()||e.githubIssue.trim())}function C(){try{let e=sessionStorage.getItem(S());if(!e)return null;let t=JSON.parse(e);return!t||typeof t!=`object`||t.id?null:{...x(),...t,id:void 0}}catch{return null}}function w(e){try{let t=S();if(!e||e.id||!ot(e)){sessionStorage.removeItem(t);return}sessionStorage.setItem(t,JSON.stringify({...e,id:void 0}))}catch{}}function st(e){let t=C();return t?e&&t.projectId!==e?{...t,projectId:e,iterationId:``,requirementId:``}:t:x(e)}function T({scopeProjectId:e=``}={}){let t=!!e,n=ge(`bugs`),{store:i,live:c,loading:l,error:x,setError:S,reload:C}=Ee(),[T,E]=p($e,`all`),D=e||T,[O,k]=p(et,`all`),[A,ct]=ye(tt,Ze,`all`),[j,lt]=ye(nt,Qe,`all`),[M,ut]=p(rt),[dt,N]=(0,v.useState)(1),[P,ft]=te(Ye,Xe),[F,I]=(0,v.useState)(null),[L,R]=(0,v.useState)(!1),[z,pt]=(0,v.useState)(!1),B=(0,v.useRef)(null),V=(0,v.useRef)(new Set),[H,U]=(0,v.useState)(null),[mt,W]=(0,v.useState)(null),G=(0,v.useMemo)(()=>de(F?.attachment??``),[F?.attachment]),ht=(0,v.useMemo)(()=>t?qe:[{key:`project`,label:`所属项目`},...qe],[t]),K=Pe(Je,ht,Ke),gt=(0,v.useMemo)(()=>t?[...b,...Ge]:[...b,We,...Ge],[t]),q=(0,v.useMemo)(()=>Ne(gt,K.isVisible),[gt,K.isVisible]),J=ze(t?`pm.bugs.cols.scoped.v2`:`pm.bugs.cols.v2`,q),_t=Le(t?`pm.bugs.scroll.scoped`:`pm.bugs.scroll`),vt=J.widthOf(`id`)??88;(0,v.useEffect)(()=>{for(let e of G)V.current.add(e.url)},[G]);let yt=(0,v.useMemo)(()=>[{value:`all`,label:`全部项目`},...i.projects.map(e=>({value:e.id,label:e.name}))],[i.projects]),bt=(0,v.useMemo)(()=>[{value:`all`,label:`全部迭代`},...i.iterations.filter(e=>D===`all`||e.projectId===D).map(e=>({value:e.id,label:e.name}))],[i.iterations,D]),xt=(0,v.useMemo)(()=>{let e=new Map(i.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[i.projects]),St=(0,v.useMemo)(()=>{let e=new Map(i.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[i.iterations]),Y=(0,v.useMemo)(()=>ae(me(i.bugs,{projectId:D,iterationId:O,status:A,severity:j,keyword:M})),[i.bugs,D,O,A,j,M]),X=t?i.bugs.filter(e=>e.projectId===D).length:i.bugs.length,Ct=Math.max(1,Math.ceil(Y.length/P)),Z=Math.min(dt,Ct),wt=Y.slice((Z-1)*P,Z*P);(0,v.useEffect)(()=>{t||c===!0&&T!==`all`&&!i.projects.some(e=>e.id===T)&&E(`all`)},[c,i.projects,T,E,t]),(0,v.useEffect)(()=>{c===!0&&O!==`all`&&!i.iterations.some(e=>e.id===O&&(D===`all`||e.projectId===D))&&k(`all`)},[c,i.iterations,D,O,k]);let Tt=F?oe(i.iterations.filter(e=>e.projectId===F.projectId)):[],Et=F?i.requirements.filter(e=>e.projectId===F.projectId):[];async function Dt(){if(!F)return;if(!F.projectId){S(`请先选择所属项目`);return}let e=F.reproduceSteps.trim();if(!e){S(`缺陷描述不能为空`);return}let t=pe(e);R(!0);try{let n={projectId:F.projectId,iterationId:F.iterationId,requirementId:F.requirementId,title:t,severity:F.severity,status:F.status,reproduceSteps:e,expectedResult:F.expectedResult,actualResult:F.actualResult,environment:F.environment,githubIssue:F.githubIssue,attachment:F.attachment,remark:F.remark};F.id?await o(`bugs`,F.id,n):await le(`bugs`,[n]);let r=!!F.id;r||w(null),I(null),V.current.clear(),S(``),await C(!0),g(r?`已保存缺陷`:`已新建缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);S(t),g(`保存缺陷失败:${t}`,`error`)}finally{R(!1)}}let Q=(0,v.useCallback)(async e=>{if(e&&e.length){pt(!0);try{let t=await he(Array.from(e));I(e=>{if(!e)return e;let n=de(e.attachment);return{...e,attachment:re([...n,...t])}}),S(``)}catch(e){S(e instanceof Error?e.message:String(e))}finally{pt(!1),B.current&&(B.current.value=``)}}},[S]),Ot=F!==null;(0,v.useEffect)(()=>{if(!Ot)return;let e=e=>{let t=se(e.clipboardData);t.length&&(e.preventDefault(),Q(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[Ot,Q]);async function kt(e){if(!F)return;let t=re(G.filter(t=>t.url!==e));if(F.id)try{await o(`bugs`,F.id,{attachment:t}),await C(!0)}catch(e){S(e instanceof Error?e.message:String(e));return}I(e=>{if(!e)return e;let n={...e,attachment:t};return n.id||w(n),n}),s([e],F.id??``)}function At(){if(F&&!F.id){if(w(F),V.current.clear(),I(null),!ot(F)){let e=G.map(e=>e.url);e.length&&s(e)}return}let e=[...V.current,...G.map(e=>e.url)];V.current.clear(),I(null),e.length&&s(e)}function $(){I(st(D===`all`?``:D))}async function jt(e,t){R(!0);try{await o(`bugs`,e.id,{status:t}),await C(!0)}catch(e){S(e instanceof Error?e.message:String(e))}finally{R(!1)}}async function Mt(){let e=H;if(e){U(null),R(!0);try{await ce(`bugs`,[e.id]),await C(!0),g(`已删除缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);S(t),g(`删除缺陷失败:${t}`,`error`)}finally{R(!1)}}}if(!n.ready)return(0,y.jsx)(we,{label:`正在读取插件开关`});if(!n.on)return(0,y.jsx)(d,{children:r(`bugs`)});if(c===null)return(0,y.jsx)(we,{label:`正在连接项目管理服务`});if(!c)return(0,y.jsx)(d,{children:`缺陷管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(i.projects.length===0&&!l&&!t)return(0,y.jsx)(d,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来记录缺陷。`});let Nt=[{value:`all`,label:`全部`},...at];return(0,y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,y.jsx)(`span`,{className:`font-medium text-stone-600`,children:X}),` 条缺陷`,Y.length===X?``:` · 筛选出 ${Y.length} 条`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,y.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选缺陷`,className:`w-36`,options:yt,value:T,onChange:e=>{E(e),k(`all`),N(1)}}),(0,y.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选缺陷`,className:`w-32`,options:bt,value:O,onChange:e=>{k(e),N(1)}}),(0,y.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按严重程度筛选缺陷`,className:`w-32`,options:[{value:`all`,label:`全部严重程度`},...it],value:j,onChange:e=>{lt(e),N(1)}}),(0,y.jsxs)(`label`,{className:`relative block`,children:[(0,y.jsx)(m,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,y.jsx)(`input`,{value:M,onChange:e=>{ut(e.target.value),N(1)},placeholder:`搜索编号 / 标题…`,className:`h-9 w-48 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,y.jsx)(Fe,{fields:K.fields,isVisible:K.isVisible,onToggle:K.toggle}),(0,y.jsxs)(`button`,{type:`button`,disabled:L,onClick:$,className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,y.jsx)(m,{name:`plus`,size:14}),`新建缺陷`]})]})]}),(0,y.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,y.jsx)(ke,{ariaLabel:`按状态筛选缺陷`,options:Nt,value:A,onChange:e=>{ct(e),N(1)}})}),x?(0,y.jsx)(Ce,{message:x,onClose:()=>S(``)}):null,(0,y.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,y.jsx)(`div`,{ref:_t,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,y.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:J.tableStyle,children:[(0,y.jsx)(`colgroup`,{children:q.map(e=>(0,y.jsx)(`col`,{style:J.widthOf(e.key)?{width:J.widthOf(e.key)}:void 0},e.key))}),(0,y.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,y.jsxs)(`tr`,{children:[(0,y.jsxs)(`th`,{className:`${Ue} relative`,children:[`ID`,(0,y.jsx)(_,{...J.resizeProps(`id`)})]}),(0,y.jsxs)(`th`,{className:Ve,style:{"--tw-sticky-left":`${vt}px`},children:[`缺陷标题`,(0,y.jsx)(_,{...J.resizeProps(`title`)})]}),K.isVisible(`severity`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`严重程度`,(0,y.jsx)(_,{...J.resizeProps(`severity`)})]}):null,K.isVisible(`status`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`缺陷状态`,(0,y.jsx)(_,{...J.resizeProps(`status`)})]}):null,!t&&K.isVisible(`project`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,y.jsx)(_,{...J.resizeProps(`project`)})]}):null,K.isVisible(`iteration`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,y.jsx)(_,{...J.resizeProps(`iteration`)})]}):null,K.isVisible(`createdAt`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`创建日期`,(0,y.jsx)(_,{...J.resizeProps(`createdAt`)})]}):null,K.isVisible(`updatedAt`)?(0,y.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`修改日期`,(0,y.jsx)(_,{...J.resizeProps(`updatedAt`)})]}):null,(0,y.jsx)(`th`,{"aria-hidden":`true`}),(0,y.jsx)(`th`,{className:Ie,children:`操作`})]})}),(0,y.jsxs)(`tbody`,{children:[l&&!i.bugs.length?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:q.length,className:`px-4 py-16 text-center`,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):wt.length===0?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:q.length,children:X?(0,y.jsx)(De,{children:`没有符合筛选条件的缺陷。`}):(0,y.jsx)(Me,{icon:`bug`,title:`暂无缺陷`,hint:`记录第一个缺陷,跟踪严重程度与修复状态。`,action:(0,y.jsxs)(`button`,{type:`button`,onClick:$,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,y.jsx)(m,{name:`plus`,size:13}),`新建缺陷`]})})})}):null,wt.map(e=>(0,y.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,y.jsx)(`td`,{className:`${He} font-mono text-xs text-stone-400`,children:e.autoId}),(0,y.jsx)(`td`,{className:Be,style:{"--tw-sticky-left":`${vt}px`},children:(0,y.jsx)(_e,{text:e.title,onClick:()=>I({id:e.id,projectId:e.projectId,iterationId:e.iterationId,requirementId:e.requirementId,title:e.title,severity:e.severity,status:e.status,reproduceSteps:e.reproduceSteps||e.title,expectedResult:e.expectedResult,actualResult:e.actualResult,environment:e.environment,githubIssue:e.githubIssue,attachment:e.attachment,remark:e.remark})})}),K.isVisible(`severity`)?(0,y.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,y.jsx)(be,{tone:je[e.severity],children:fe[e.severity]})}):null,K.isVisible(`status`)?(0,y.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,y.jsx)(a,{unstyled:!0,fitContent:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:L,options:at,value:e.status,onChange:t=>void jt(e,t),renderOptionPrefix:e=>(0,y.jsx)(Ae,{tone:Oe[e.value]}),renderTrigger:()=>(0,y.jsx)(be,{tone:Oe[e.status],children:ue[e.status]})})}):null,!t&&K.isVisible(`project`)?(0,y.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,y.jsx)(`a`,{href:ve(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:xt(e.projectId)})}):null,K.isVisible(`iteration`)?(0,y.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:St(e.iterationId)}):null,K.isVisible(`createdAt`)?(0,y.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:u(e.createdAt)}):null,K.isVisible(`updatedAt`)?(0,y.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:u(e.updatedAt)}):null,(0,y.jsx)(`td`,{"aria-hidden":`true`}),(0,y.jsx)(`td`,{className:Re,children:(0,y.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:L,onClick:()=>U(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,y.jsx)(m,{name:`trash`,size:15})})})]},e.id))]})]})}),Y.length>0?(0,y.jsx)(ne,{page:Z,totalPages:Ct,pageSize:P,busy:L,onPage:N,onPageSize:e=>{ft(e),N(1)}}):null]}),(0,y.jsx)(Se,{open:F!==null,title:F?.id?`编辑缺陷`:`新建缺陷`,busy:L,submitLabel:F?.id?`保存`:`创建`,onClose:At,onSubmit:()=>void Dt(),children:F?(0,y.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,y.jsx)(f,{label:`所属项目`,required:!0,children:(0,y.jsx)(h,{ariaLabel:`所属项目`,options:i.projects.map(e=>({value:e.id,label:e.name})),value:F.projectId,onChange:e=>I({...F,projectId:e,iterationId:``,requirementId:``})})}),(0,y.jsx)(f,{label:`所属迭代`,children:(0,y.jsx)(h,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...Tt.map(e=>({value:e.id,label:e.name}))],value:F.iterationId,onChange:e=>I({...F,iterationId:e}),disabled:Tt.length===0})}),(0,y.jsx)(f,{label:`关联需求`,children:(0,y.jsx)(h,{ariaLabel:`关联需求`,options:[{value:``,label:`不关联需求`},...Et.map(e=>({value:e.id,label:`${e.autoId} ${e.title}`}))],value:F.requirementId,onChange:e=>I({...F,requirementId:e}),disabled:Et.length===0})}),(0,y.jsx)(f,{label:`缺陷描述`,required:!0,children:(0,y.jsx)(`textarea`,{autoFocus:!0,value:F.reproduceSteps,onChange:e=>I({...F,reproduceSteps:e.target.value}),placeholder:`描述问题现象、复现步骤与影响范围`,rows:5,className:xe})}),(0,y.jsx)(f,{label:`严重程度`,children:(0,y.jsx)(h,{ariaLabel:`严重程度`,options:it,value:F.severity,onChange:e=>I({...F,severity:e}),renderOptionPrefix:e=>(0,y.jsx)(Ae,{tone:je[e.value]})})}),(0,y.jsx)(f,{label:`附件`,children:(0,y.jsxs)(`div`,{className:`space-y-2`,children:[G.length?(0,y.jsx)(`ul`,{className:`space-y-1.5`,children:G.map(e=>{let t=ie(e.url);return(0,y.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>W(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,y.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,y.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,y.jsx)(m,{name:`file`,size:15})}),t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>W(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>kt(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url)})}):null,(0,y.jsx)(`input`,{ref:B,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void Q(e.target.files)}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`button`,{type:`button`,disabled:z,onClick:()=>B.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,y.jsx)(m,{name:z?`file`:`plus`,size:13}),z?`上传中…`:`上传文件 / 图片`]}),(0,y.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可直接粘贴截图 / 图片(⌘V / Ctrl+V),支持多张`})]})]})}),(0,y.jsx)(f,{label:`备注`,children:(0,y.jsx)(`textarea`,{value:F.remark,onChange:e=>I({...F,remark:e.target.value}),rows:2,className:xe})}),F.id?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f,{label:`创建日期`,children:(0,y.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:u(i.bugs.find(e=>e.id===F.id)?.createdAt)})}),(0,y.jsx)(f,{label:`修改日期`,children:(0,y.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:u(i.bugs.find(e=>e.id===F.id)?.updatedAt)})})]}):null]}):null}),(0,y.jsx)(ee,{open:H!==null,title:`删除缺陷`,message:`确定删除「${H?.title??``}」?此操作无法恢复。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>U(null),onConfirm:()=>void Mt()}),(0,y.jsx)(Te,{file:mt,onClose:()=>W(null)})]})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.BRvXWHLe.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./ConfirmDialog.DrrPf1MB.js";import{t as a}from"./DatePicker.Bkl71M49.js";import{t as o}from"./SelectDropdown.T3CKHaLt.js";import{L as s,O as ee,P as te,R as c,S as l,a as u,g as ne,h as re,k as ie,o as d}from"./pm.BXmOiFfW.js";import{A as ae,D as oe,O as se,S as f,_ as p,a as ce,c as le,d as ue,f as m,g as h,i as g,j as _,k as v,l as de,m as y,r as b,s as fe,u as pe,v as x,y as S}from"./PmShared.BK8kWRSV.js";import{showToast as C}from"./Toast.BO2NFckG.js";var w=e(t(),1),T=r(),E=10,me=[`all`,...u],he=`pm.iterations.project`,ge=`pm.iterations.status`,_e=`pm.iterations.keyword`,D=u.map(e=>({value:e,label:d[e]}));function O(e=``){return{projectId:e,name:``,startDate:``,endDate:``,status:`planning`,remark:``}}function k({scopeProjectId:e=``}={}){let t=!!e,r=ae(`iterations`),{store:u,live:k,loading:A,error:j,setError:M,reload:N}=_(),[P,F]=v(he,`all`),I=e||P,[L,ve]=se(ge,me,`all`),[R,ye]=v(_e),[be,z]=(0,w.useState)(1),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(!1),[W,G]=(0,w.useState)(null),K=s(),q=(0,w.useMemo)(()=>{let e=new Map(u.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`未关联项目`},[u.projects]),xe=(0,w.useMemo)(()=>[{value:`all`,label:`全部项目`},...u.projects.map(e=>({value:e.id,label:e.name}))],[u.projects]),J=(0,w.useMemo)(()=>te(l(u.iterations,{projectId:I,status:L,keyword:R})),[u.iterations,I,L,R]),Y=t?u.iterations.filter(e=>e.projectId===I).length:u.iterations.length,X=Math.max(1,Math.ceil(J.length/E)),Z=Math.min(be,X),Q=J.slice((Z-1)*E,Z*E);(0,w.useEffect)(()=>{t||k===!0&&P!==`all`&&!u.projects.some(e=>e.id===P)&&F(`all`)},[k,u.projects,P,F,t]);async function Se(){if(!B)return;if(!B.projectId){M(`请先选择所属项目`);return}let e=B.name.trim();if(!e)M(`迭代名称不能为空`);else if(B.startDate&&B.endDate&&B.endDate<B.startDate)M(`迭代结束日期不能早于开始日期`);else{U(!0);try{let t={projectId:B.projectId,name:e,startDate:B.startDate,endDate:B.endDate,status:B.status,remark:B.remark};B.id?await c(`iterations`,B.id,t):await re(`iterations`,[t]),V(null),M(``),await N(!0),C(B.id?`已保存迭代`:`已新建迭代`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);M(t),C(`保存迭代失败:${t}`,`error`)}finally{U(!1)}}}async function $(e,t){U(!0);try{await c(`iterations`,e.id,{status:t}),await N(!0),C(`已更新迭代状态为「${t}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);M(t),C(`更新迭代失败:${t}`,`error`)}finally{U(!1)}}async function Ce(){let e=W;if(e){G(null),U(!0);try{await ne(`iterations`,[e.id]),await N(!0),C(`已删除迭代`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);M(t),C(`删除迭代失败:${t}`,`error`)}finally{U(!1)}}}return r.ready?r.on?k===null?(0,T.jsx)(h,{label:`正在连接项目管理服务`}):k?u.projects.length===0&&!A&&!t?(0,T.jsx)(p,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护迭代。`}):(0,T.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-600`,children:Y}),` 个迭代`,J.length===Y?``:` · 筛选出 ${J.length} 个`]}),(0,T.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,T.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选迭代`,className:`w-36`,options:xe,value:P,onChange:e=>{F(e),z(1)}}),(0,T.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按状态筛选迭代`,className:`w-28`,options:[{value:`all`,label:`全部状态`},...D],value:L,onChange:e=>{ve(e),z(1)}}),(0,T.jsxs)(`label`,{className:`relative block`,children:[(0,T.jsx)(y,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,T.jsx)(`input`,{value:R,onChange:e=>{ye(e.target.value),z(1)},placeholder:`搜索迭代名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,T.jsxs)(`button`,{type:`button`,disabled:H,onClick:()=>V(O(I===`all`?``:I)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,T.jsx)(y,{name:`plus`,size:14}),`新建迭代`]})]})]}),j?(0,T.jsx)(ue,{message:j,onClose:()=>M(``)}):null,(0,T.jsx)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-auto pb-4`,children:A&&!u.iterations.length?(0,T.jsx)(`div`,{className:`flex min-h-[200px] items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):Q.length===0?Y?(0,T.jsx)(de,{children:`没有符合筛选条件的迭代。`}):(0,T.jsx)(pe,{icon:`calendar`,title:`暂无迭代`,hint:`新建一个迭代,用开始 / 截止日期跟踪进度。`,action:(0,T.jsxs)(`button`,{type:`button`,onClick:()=>V(O(I===`all`?``:I)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,T.jsx)(y,{name:`plus`,size:13}),`新建迭代`]})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:Q.map(e=>{let n=ie(e,K),r=ee(e,K),i=e.endDate&&e.status!==`done`?Math.round((Date.parse(`${e.endDate}T00:00:00`)-Date.parse(`${K}T00:00:00`))/864e5):null;return(0,T.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-3.5 transition-[border-color,box-shadow] hover:border-[#ddd6fe] hover:shadow-sm`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`truncate text-[15px] font-medium text-stone-800`,children:e.name}),(0,T.jsx)(f,{tone:b[e.status],children:d[e.status]})]}),(0,T.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-stone-500`,children:[t?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`a`,{href:oe(e.projectId),className:`transition-colors hover:text-[#3370ff]`,children:q(e.projectId)}),(0,T.jsx)(`span`,{className:`text-stone-300`,children:`·`})]}),(0,T.jsxs)(`span`,{className:`tabular-nums`,children:[e.startDate||`—`,` → `,e.endDate||`—`]}),r===null?i!==null&&i>=0&&e.endDate?(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[`还剩 `,i,` 天`]}):null:(0,T.jsxs)(`span`,{className:`text-red-500`,children:[`逾期 `,r,` 天`]})]}),e.remark?(0,T.jsx)(`p`,{className:`mt-1 line-clamp-1 text-xs text-stone-400`,children:e.remark}):null]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.status===`planning`?(0,T.jsxs)(`button`,{type:`button`,disabled:H,onClick:()=>void $(e,`in_progress`),className:`inline-flex h-8 items-center gap-1 rounded-lg px-2 text-xs text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:[(0,T.jsx)(y,{name:`play`,size:12}),`开始`]}):null,e.status===`in_progress`?(0,T.jsxs)(`button`,{type:`button`,disabled:H,onClick:()=>void $(e,`done`),className:`inline-flex h-8 items-center gap-1 rounded-lg px-2 text-xs text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:[(0,T.jsx)(y,{name:`check`,size:12}),`完成`]}):null,(0,T.jsx)(`button`,{type:`button`,"aria-label":`编辑 ${e.name}`,onClick:()=>V({id:e.id,projectId:e.projectId,name:e.name,startDate:e.startDate,endDate:e.endDate,status:e.status,remark:e.remark}),className:`flex h-8 w-8 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,children:(0,T.jsx)(y,{name:`pencil`,size:15})}),(0,T.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.name}`,disabled:H,onClick:()=>G(e),className:`tw-icon-danger flex h-8 w-8 items-center justify-center rounded-lg`,children:(0,T.jsx)(y,{name:`trash`,size:15})})]})]}),(0,T.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-[#3370ff] transition-[width] duration-300`,style:{width:`${n}%`}})}),(0,T.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs tabular-nums text-stone-500`,children:[n,`%`]})]})]},e.id)})})}),J.length>0?(0,T.jsx)(x,{page:Z,totalPages:X,busy:H,onPage:z}):null,(0,T.jsx)(le,{open:B!==null,title:B?.id?`编辑迭代`:`新建迭代`,busy:H,submitLabel:B?.id?`保存`:`创建`,onClose:()=>V(null),onSubmit:()=>void Se(),children:B?(0,T.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,T.jsx)(m,{label:`所属项目`,required:!0,children:(0,T.jsx)(S,{ariaLabel:`所属项目`,options:u.projects.map(e=>({value:e.id,label:e.name})),value:B.projectId,onChange:e=>V({...B,projectId:e}),disabled:u.projects.length===0})}),(0,T.jsx)(m,{label:`迭代名称`,required:!0,children:(0,T.jsx)(`input`,{autoFocus:!0,value:B.name,onChange:e=>V({...B,name:e.target.value}),placeholder:`如:v1.0 迭代`,className:g})}),(0,T.jsx)(m,{label:`开始日期`,children:(0,T.jsx)(a,{value:B.startDate,onChange:e=>V({...B,startDate:e}),placeholder:`选择开始日期`,className:`${g} tabular-nums`})}),(0,T.jsx)(m,{label:`截止日期`,children:(0,T.jsx)(a,{value:B.endDate,onChange:e=>V({...B,endDate:e}),placeholder:`选择截止日期`,className:`${g} tabular-nums`})}),(0,T.jsx)(m,{label:`状态`,children:(0,T.jsx)(S,{ariaLabel:`迭代状态`,options:D,value:B.status,onChange:e=>V({...B,status:e}),renderOptionPrefix:e=>(0,T.jsx)(fe,{tone:b[e.value]})})}),(0,T.jsx)(m,{label:`备注`,children:(0,T.jsx)(`textarea`,{value:B.remark,onChange:e=>V({...B,remark:e.target.value}),placeholder:`迭代目标、范围等(可选)`,rows:3,className:ce})})]}):null}),(0,T.jsx)(i,{open:W!==null,title:`删除迭代`,message:`确定删除「${W?.name??``}」?关联的需求与缺陷会保留,但不再关联到这个迭代。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>G(null),onConfirm:()=>void Ce()})]}):(0,T.jsx)(p,{children:`迭代管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,T.jsx)(p,{children:n(`iterations`)}):(0,T.jsx)(h,{label:`正在读取插件开关`})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.BRvXWHLe.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{M as i,c as a}from"./pm.BXmOiFfW.js";import{A as o,O as s,S as c,_ as l,b as u,g as d,j as f,m as p,o as m,u as h,x as g}from"./PmShared.BK8kWRSV.js";import _ from"./PmBugsBoard.CGpXUTPu.js";import v from"./PmIterationsBoard.BaKiFIam.js";import{t as y}from"./PmRequirementsBoard.DsK6RF7Q.js";var b=e(t(),1),x=r(),S=[`iterations`,`requirements`,`bugs`],C=`pm.project.tab`,w=`/pm/projects/`;function T(){let e=o(`projects`);return e.ready?e.on?(0,x.jsx)(u,{children:(0,x.jsx)(E,{})}):(0,x.jsx)(l,{children:n(`projects`)}):(0,x.jsx)(d,{label:`正在读取插件开关`})}function E(){let{store:e,live:t,loading:n}=f(),[r,o]=(0,b.useState)(``),[u,T]=s(C,S,`iterations`);(0,b.useEffect)(()=>{o(new URLSearchParams(window.location.search).get(`id`)??``)},[]);let E=(0,b.useMemo)(()=>e.projects.find(e=>e.id===r),[e.projects,r]),O=(0,b.useMemo)(()=>i(e),[e]);if(t===null)return(0,x.jsx)(d,{label:`正在连接项目管理服务`});if(!t)return(0,x.jsx)(l,{children:`项目详情需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(!E)return n&&!e.projects.length?(0,x.jsx)(d,{label:`正在读取项目`}):(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsx)(D,{}),(0,x.jsx)(h,{icon:`folder`,title:`没有找到这个项目`,hint:`它可能已被删除,或链接里的项目 id 不正确。`})]});let k=O[E.id],A=[{value:`iterations`,label:`迭代`,count:k?.iterations??0},{value:`requirements`,label:`需求`,count:k?.requirements??0},{value:`bugs`,label:`缺陷`,count:k?.bugs??0}];return(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3`,children:[(0,x.jsx)(`a`,{href:w,"aria-label":`返回项目列表`,className:`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-800`,children:(0,x.jsx)(p,{name:`arrowLeft`,size:18})}),(0,x.jsx)(`span`,{className:`tw-pm-tile flex h-9 w-9 shrink-0 items-center justify-center rounded-xl text-sm font-bold`,children:E.name.slice(0,1)}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`h1`,{className:`truncate text-lg font-semibold text-stone-800`,children:E.name}),(0,x.jsx)(c,{tone:m[E.status],children:a[E.status]})]}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs ${E.description?`text-stone-400`:`text-stone-300 italic`}`,children:E.description||`暂无描述`})]})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(g,{tabs:A,value:u,onChange:T,ariaLabel:`项目二级菜单`}),(0,x.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`需求完成 `,k?.requirementPercent??0,`% · 缺陷完成 `,k?.bugClosedPercent??100,`%`]})]}),(0,x.jsxs)(`div`,{className:`mt-4 flex min-h-0 flex-1 flex-col`,children:[u===`iterations`?(0,x.jsx)(v,{scopeProjectId:E.id}):null,u===`requirements`?(0,x.jsx)(y,{scopeProjectId:E.id}):null,u===`bugs`?(0,x.jsx)(_,{scopeProjectId:E.id}):null]})]})}function D(){return(0,x.jsxs)(`a`,{href:w,className:`mb-2 inline-flex w-fit items-center gap-1.5 text-sm text-stone-500 transition-colors hover:text-stone-800`,children:[(0,x.jsx)(p,{name:`arrowLeft`,size:16}),`返回项目列表`]})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.BRvXWHLe.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.DrrPf1MB.js";import{t as te}from"./SelectDropdown.T3CKHaLt.js";import{C as i,M as a,R as o,c as s,g as ne,h as re,s as c}from"./pm.BXmOiFfW.js";import{A as ie,D as ae,O as l,S as u,_ as d,a as f,c as p,d as m,f as h,g,i as _,j as v,k as y,l as b,m as x,o as S,s as oe,u as se,v as ce,y as le}from"./PmShared.BK8kWRSV.js";import{showToast as C}from"./Toast.BO2NFckG.js";var w=e(t(),1),T=r(),E=10,D=c.map(e=>({value:e,label:s[e]})),O=[`all`,...c],k=`pm.projects.status`,A=`pm.projects.keyword`;function j(){return{name:``,description:``,status:`planning`}}function M(){let e=ie(`projects`),{store:t,live:r,loading:c,error:M,setError:N,reload:P}=v(),[F,I]=l(k,O,`all`),[L,R]=y(A),[z,B]=(0,w.useState)(1),[V,H]=(0,w.useState)(null),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)(null),[q,J]=(0,w.useState)(null),Y=(0,w.useRef)(null),ue=(0,w.useMemo)(()=>a(t),[t]),X=(0,w.useMemo)(()=>i(t.projects,{status:F,keyword:L}),[t.projects,F,L]),Z=Math.max(1,Math.ceil(X.length/E)),Q=Math.min(z,Z),$=X.slice((Q-1)*E,Q*E);(0,w.useEffect)(()=>{if(!q)return;function e(e){Y.current?.contains(e.target)||J(null)}function t(e){e.key===`Escape`&&J(null)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[q]);async function de(){if(!V)return;let e=V.name.trim();if(!e)N(`项目名称不能为空`);else{W(!0);try{V.id?await o(`projects`,V.id,{name:e,description:V.description,status:V.status}):await re(`projects`,[{name:e,description:V.description,status:V.status}]),H(null),N(``),await P(!0),C(V.id?`已保存项目`:`已新建项目`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);N(t),C(`保存项目失败:${t}`,`error`)}finally{W(!1)}}}async function fe(e){J(null),W(!0);try{let t=e.status!==`archived`;await o(`projects`,e.id,{status:t?`archived`:`planning`}),await P(!0),C(t?`已归档「${e.name}」`:`已取消归档「${e.name}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);N(t),C(`更新项目失败:${t}`,`error`)}finally{W(!1)}}async function pe(){let e=G;if(e){K(null),W(!0);try{await ne(`projects`,[e.id]),await P(!0),C(`已删除项目`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);N(t),C(`删除项目失败:${t}`,`error`)}finally{W(!1)}}}return e.ready?e.on?r===null?(0,T.jsx)(g,{label:`正在连接项目管理服务`}):r?(0,T.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`text-xs text-stone-400`,children:t.projects.length?(0,T.jsxs)(T.Fragment,{children:[`共 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-600`,children:t.projects.length}),` 个项目`,X.length===t.projects.length?``:` · 筛选出 ${X.length} 个`]}):`暂无项目`}),(0,T.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(te,{flat:!0,showCheck:!1,ariaLabel:`按状态筛选项目`,className:`w-32`,options:[{value:`all`,label:`全部状态`},...D],value:F,onChange:e=>{I(e),B(1)}}),(0,T.jsxs)(`label`,{className:`relative block`,children:[(0,T.jsx)(x,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,T.jsx)(`input`,{value:L,onChange:e=>{R(e.target.value),B(1)},placeholder:`搜索项目名称 / 描述…`,className:`h-9 w-52 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,T.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>H(j()),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,T.jsx)(x,{name:`plus`,size:14}),`新建项目`]})]})]}),M?(0,T.jsx)(m,{message:M,onClose:()=>N(``)}):null,(0,T.jsx)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-auto pt-1 pb-4`,children:c&&!t.projects.length?(0,T.jsx)(`div`,{className:`flex min-h-[200px] items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):$.length===0?t.projects.length?(0,T.jsx)(b,{children:`没有符合筛选条件的项目。`}):(0,T.jsx)(se,{icon:`folder`,title:`暂无项目`,hint:`创建第一个项目开始吧`,action:(0,T.jsxs)(`button`,{type:`button`,onClick:()=>H(j()),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,T.jsx)(x,{name:`plus`,size:13}),`新建项目`]})}):(0,T.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>{let t=ue[e.id];return(0,T.jsxs)(`article`,{className:`tw-pm-card group relative rounded-2xl border border-stone-200 bg-white`,children:[(0,T.jsx)(`span`,{className:`pointer-events-none absolute inset-0 overflow-hidden rounded-2xl`,"aria-hidden":`true`,children:(0,T.jsx)(`span`,{className:`tw-pm-card-accent absolute -right-6 -top-6 h-20 w-20 rounded-full bg-[#f1edff]`})}),(0,T.jsx)(`a`,{href:ae(e.id),"aria-label":`打开项目 ${e.name}`,className:`absolute inset-0 z-0 rounded-2xl`}),(0,T.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex h-full flex-col p-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,T.jsx)(`span`,{className:`tw-pm-tile flex h-8 w-8 shrink-0 items-center justify-center rounded-xl text-xs font-bold`,children:e.name.slice(0,1)}),(0,T.jsx)(`h3`,{className:`truncate text-[15px] font-semibold text-stone-800`,children:e.name})]}),(0,T.jsx)(u,{tone:S[e.status],children:s[e.status]})]}),(0,T.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-[40px] text-sm ${e.description?`text-stone-500`:`italic text-stone-300`}`,children:e.description||`暂无描述`}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-xs text-stone-500`,children:[(0,T.jsxs)(`span`,{children:[t?.iterations??0,` 迭代`]}),(0,T.jsx)(`span`,{className:`text-stone-300`,children:`·`}),(0,T.jsxs)(`span`,{children:[t?.requirements??0,` 需求`]}),(0,T.jsx)(`span`,{className:`text-stone-300`,children:`·`}),(0,T.jsxs)(`span`,{children:[t?.bugs??0,` 缺陷`]})]}),(0,T.jsxs)(`div`,{className:`mt-auto flex items-center justify-between pt-4`,children:[(0,T.jsxs)(`div`,{className:`pointer-events-auto relative`,ref:q===e.id?Y:void 0,children:[(0,T.jsx)(`button`,{type:`button`,"aria-label":`${e.name} 的操作`,"aria-haspopup":`menu`,"aria-expanded":q===e.id,onClick:()=>J(q===e.id?null:e.id),className:`flex h-8 w-8 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,children:(0,T.jsx)(x,{name:`more`,size:18})}),q===e.id?(0,T.jsxs)(`div`,{role:`menu`,className:`absolute left-0 top-9 z-30 w-36 overflow-hidden rounded-lg border border-stone-200 bg-white py-1 shadow-lg`,children:[(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{J(null),H({id:e.id,name:e.name,description:e.description,status:e.status})},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-stone-700 hover:bg-stone-50`,children:[(0,T.jsx)(x,{name:`pencil`,size:14}),`编辑`]}),(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void fe(e),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-stone-700 hover:bg-stone-50`,children:[(0,T.jsx)(x,{name:`folder`,size:14}),e.status===`archived`?`取消归档`:`归档`]}),(0,T.jsx)(`div`,{className:`my-1 border-t border-stone-100`}),(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{J(null),K(e)},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-red-600 hover:bg-red-50`,children:[(0,T.jsx)(x,{name:`trash`,size:14}),`删除`]})]}):null]}),(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-stone-400`,children:[`需求完成 `,t?.requirementPercent??0,`%`,(0,T.jsx)(x,{name:`chevronRight`,size:14,className:`tw-pm-card-chevron text-stone-300`})]})]})]})]},e.id)})})}),X.length>0?(0,T.jsx)(ce,{page:Q,totalPages:Z,busy:U,onPage:B}):null,(0,T.jsx)(p,{open:V!==null,title:V?.id?`编辑项目`:`新建项目`,busy:U,submitLabel:V?.id?`保存`:`创建`,onClose:()=>H(null),onSubmit:()=>void de(),children:V?(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(h,{label:`项目名称`,required:!0,children:(0,T.jsx)(`input`,{autoFocus:!0,value:V.name,onChange:e=>H({...V,name:e.target.value}),placeholder:`输入项目名称`,className:_})}),(0,T.jsx)(h,{label:`描述`,children:(0,T.jsx)(`textarea`,{value:V.description,onChange:e=>H({...V,description:e.target.value}),placeholder:`项目描述(可选)`,rows:4,className:f})}),(0,T.jsx)(h,{label:`状态`,children:(0,T.jsx)(le,{ariaLabel:`项目状态`,options:D,value:V.status,onChange:e=>H({...V,status:e}),renderOptionPrefix:e=>(0,T.jsx)(oe,{tone:S[e.value]})})})]}):null}),(0,T.jsx)(ee,{open:G!==null,title:`删除项目`,message:`确定删除「${G?.name??``}」?该项目下的迭代、需求与缺陷会一并删除,且无法恢复。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:`solid`,onClose:()=>K(null),onConfirm:()=>void pe()})]}):(0,T.jsx)(d,{children:`项目列表需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,T.jsx)(d,{children:n(`projects`)}):(0,T.jsx)(g,{label:`正在读取插件开关`})}export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as default}from"./PmRequirementsBoard.DsK6RF7Q.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.BmKRnp4a.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./ConfirmDialog.D5qXeML0.js";import{n as a,t as ee}from"./DocsPager.ceBEecmd.js";import{t as o}from"./SelectDropdown.Dmk5n225.js";import{A as s,D as c,F as l,P as u,R as d,b as f,d as p,f as m,g as te,h,j as g,l as _,m as ne,u as v,w as re,z as y}from"./pm.BXmOiFfW.js";import{A as ie,C as ae,D as oe,E as b,O as se,S as ce,T as x,_ as S,a as le,c as ue,d as de,f as C,g as fe,h as w,j as pe,k as T,l as me,m as E,p as he,s as D,u as ge,w as _e,y as O}from"./PmShared.86HEsdd_.js";import{n as ve,r as ye,t as be}from"./TableFieldConfig.D0v9S2g3.js";import{showToast as k}from"./Toast.BO2NFckG.js";import{c as xe,d as Se,i as Ce,l as we,n as Te,o as Ee,r as De,s as Oe,t as A}from"./ColumnResize.CkE59sGq.js";var j=e(t(),1),M=r();function ke({value:e,onChange:t,entity:n,recordId:r=``,seenUrls:i,onError:a,onPersisted:ee}){let o=g(e),[l,u]=(0,j.useState)(!1),[p,m]=(0,j.useState)(!1),[te,h]=(0,j.useState)(null),_=(0,j.useRef)(null);(0,j.useEffect)(()=>{for(let t of g(e))i.current.add(t.url)},[e,i]);let v=(0,j.useCallback)(async n=>{if(n&&n.length){u(!0);try{let r=await y(Array.from(n));t(s([...g(e),...r])),a(``)}catch(e){a(e instanceof Error?e.message:String(e))}finally{u(!1),_.current&&(_.current.value=``)}}},[t,a,e]);(0,j.useEffect)(()=>{let e=e=>{let t=f(e.clipboardData);t.length&&(e.preventDefault(),v(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[v]);async function re(e){let i=s(o.filter(t=>t.url!==e));if(r)try{await d(n,r,{attachment:i}),ee?.()}catch(e){a(e instanceof Error?e.message:String(e));return}t(i),ne([e],r)}return(0,M.jsxs)(`div`,{className:`space-y-2 rounded-lg transition-colors ${p?`bg-[#3370ff]/5 ring-1 ring-[#3370ff]/40`:``}`,onDragOver:e=>{e.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:e=>{e.preventDefault(),m(!1),v(e.dataTransfer?.files??null)},children:[o.length?(0,M.jsx)(`ul`,{className:`space-y-1.5`,children:o.map(e=>(0,M.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[c(e.url)?(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,M.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,M.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,M.jsx)(E,{name:`file`,size:15})}),c(e.url)?(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,M.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>void re(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url))}):null,(0,M.jsx)(`input`,{ref:_,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void v(e.target.files)}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>_.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,M.jsx)(E,{name:l?`file`:`plus`,size:13}),l?`上传中…`:`上传文件 / 图片`]}),(0,M.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可拖拽到这里,或直接粘贴截图(⌘V / Ctrl+V),支持多张`})]}),(0,M.jsx)(w,{file:te,onClose:()=>h(null)})]})}var Ae=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`priority`,width:100,min:80},{key:`status`,width:120,min:96}],je={key:`project`,width:140,min:100},Me=[{key:`iteration`,width:120,min:88},{key:`createdAt`,width:140,min:110},{key:`updatedAt`,width:140,min:110},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],Ne=new Set([`id`,`title`,`filler`,`action`]),Pe=[{key:`priority`,label:`优先级`},{key:`status`,label:`需求状态`},{key:`iteration`,label:`所属迭代`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Fe=`pm.requirements.fields`,Ie=20,Le=`tw.pm-requirements.page-size.v1`,Re=[`all`,...p],ze=[`all`,..._],Be=`pm.requirements.project`,Ve=`pm.requirements.iteration`,He=`pm.requirements.status`,Ue=`pm.requirements.priority`,We=`pm.requirements.keyword`,Ge=_.map(e=>({value:e,label:v[e]})),N=p.map(e=>({value:e,label:m[e]}));function Ke(e=``){return{projectId:e,iterationId:``,title:``,priority:`medium`,status:`pending`,description:``,acceptanceCriteria:[],githubIssue:``,attachment:``}}function P({scopeProjectId:e=``}={}){let t=!!e,r=ie(`pmRequirements`),{store:s,live:c,loading:f,error:p,setError:_,reload:y}=pe(),[w,P]=T(Be,`all`),F=e||w,[I,L]=T(Ve,`all`),[R,qe]=se(He,Re,`all`),[z,Je]=se(Ue,ze,`all`),[B,Ye]=T(We),[Xe,V]=(0,j.useState)(1),[H,Ze]=a(Ie,Le),[U,W]=(0,j.useState)(null),[G,K]=(0,j.useState)(!1),[q,J]=(0,j.useState)(null),Y=(0,j.useRef)(new Set),Qe=(0,j.useMemo)(()=>t?Pe:[{key:`project`,label:`所属项目`},...Pe],[t]),X=ye(Fe,Qe,Ne),$e=(0,j.useMemo)(()=>t?[...Ae,...Me]:[...Ae,je,...Me],[t]),Z=(0,j.useMemo)(()=>ve($e,X.isVisible),[$e,X.isVisible]),Q=we(t?`pm.requirements.cols.scoped.v2`:`pm.requirements.cols.v2`,Z),et=Se(t?`pm.requirements.scroll.scoped`:`pm.requirements.scroll`),tt=Q.widthOf(`id`)??88,nt=(0,j.useMemo)(()=>[{value:`all`,label:`全部项目`},...s.projects.map(e=>({value:e.id,label:e.name}))],[s.projects]),rt=(0,j.useMemo)(()=>[{value:`all`,label:`全部迭代`},...u(s.iterations.filter(e=>F===`all`||e.projectId===F)).map(e=>({value:e.id,label:e.name}))],[s.iterations,F]),it=(0,j.useMemo)(()=>{let e=new Map(s.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[s.projects]),at=(0,j.useMemo)(()=>{let e=new Map(s.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[s.iterations]),$=(0,j.useMemo)(()=>l(re(s.requirements,{projectId:F,iterationId:I,status:R,priority:z,keyword:B})),[s.requirements,F,I,R,z,B]),ot=t?s.requirements.filter(e=>e.projectId===F).length:s.requirements.length,st=Math.max(1,Math.ceil($.length/H)),ct=Math.min(Xe,st),lt=$.slice((ct-1)*H,ct*H);(0,j.useEffect)(()=>{t||c===!0&&w!==`all`&&!s.projects.some(e=>e.id===w)&&P(`all`)},[c,s.projects,w,P,t]),(0,j.useEffect)(()=>{c===!0&&I!==`all`&&!s.iterations.some(e=>e.id===I&&(F===`all`||e.projectId===F))&&L(`all`)},[c,s.iterations,F,I,L]);let ut=U?u(s.iterations.filter(e=>e.projectId===U.projectId)):[];async function dt(){if(!U)return;if(!U.projectId){_(`请先选择所属项目`);return}let e=U.title.trim();if(!e)_(`需求描述不能为空`);else{K(!0);try{let t={projectId:U.projectId,iterationId:U.iterationId,title:e,priority:U.priority,status:U.status,description:U.description,acceptanceCriteria:U.acceptanceCriteria.filter(e=>e.text.trim()),githubIssue:U.githubIssue,attachment:U.attachment};U.id?await d(`requirements`,U.id,t):await h(`requirements`,[t]);let n=!!U.id;W(null),Y.current.clear(),_(``),await y(!0),k(n?`已保存需求`:`已新建需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);_(t),k(`保存需求失败:${t}`,`error`)}finally{K(!1)}}}function ft(){let e=[...Y.current,...g(U?.attachment??``).map(e=>e.url)];Y.current.clear(),W(null),e.length&&ne(e)}async function pt(e,t){K(!0);try{await d(`requirements`,e.id,{status:t}),await y(!0),k(`已更新需求状态为「${t}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);_(t),k(`更新状态失败:${t}`,`error`)}finally{K(!1)}}async function mt(){let e=q;if(e){J(null),K(!0);try{await te(`requirements`,[e.id]),await y(!0),k(`已删除需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);_(t),k(`删除需求失败:${t}`,`error`)}finally{K(!1)}}}if(!r.ready)return(0,M.jsx)(fe,{label:`正在读取插件开关`});if(!r.on)return(0,M.jsx)(S,{children:n(`pmRequirements`)});if(c===null)return(0,M.jsx)(fe,{label:`正在连接项目管理服务`});if(!c)return(0,M.jsx)(S,{children:`需求管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(s.projects.length===0&&!f&&!t)return(0,M.jsx)(S,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护需求。`});let ht=[{value:`all`,label:`全部`},...N];return(0,M.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,M.jsx)(`span`,{className:`font-medium text-stone-600`,children:ot}),` 条需求`,$.length===ot?``:` · 筛选出 ${$.length} 条`]}),(0,M.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,M.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选需求`,className:`w-36`,options:nt,value:w,onChange:e=>{P(e),L(`all`),V(1)}}),(0,M.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选需求`,className:`w-32`,options:rt,value:I,onChange:e=>{L(e),V(1)}}),(0,M.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按优先级筛选需求`,className:`w-28`,options:[{value:`all`,label:`全部优先级`},...Ge],value:z,onChange:e=>{Je(e),V(1)}}),(0,M.jsxs)(`label`,{className:`relative block`,children:[(0,M.jsx)(E,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,M.jsx)(`input`,{value:B,onChange:e=>{Ye(e.target.value),V(1)},placeholder:`搜索编号 / 名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,M.jsx)(be,{fields:X.fields,isVisible:X.isVisible,onToggle:X.toggle}),(0,M.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>W(Ke(F===`all`?``:F)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,M.jsx)(E,{name:`plus`,size:14}),`新建需求`]})]})]}),(0,M.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,M.jsx)(he,{ariaLabel:`按状态筛选需求`,options:ht,value:R,onChange:e=>{qe(e),V(1)}})}),p?(0,M.jsx)(de,{message:p,onClose:()=>_(``)}):null,(0,M.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,M.jsx)(`div`,{ref:et,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,M.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:Q.tableStyle,children:[(0,M.jsx)(`colgroup`,{children:Z.map(e=>(0,M.jsx)(`col`,{style:Q.widthOf(e.key)?{width:Q.widthOf(e.key)}:void 0},e.key))}),(0,M.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,M.jsxs)(`tr`,{children:[(0,M.jsxs)(`th`,{className:`${Oe} relative`,children:[`ID`,(0,M.jsx)(A,{...Q.resizeProps(`id`)})]}),(0,M.jsxs)(`th`,{className:Ee,style:{"--tw-sticky-left":`${tt}px`},children:[`需求描述`,(0,M.jsx)(A,{...Q.resizeProps(`title`)})]}),X.isVisible(`priority`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`优先级`,(0,M.jsx)(A,{...Q.resizeProps(`priority`)})]}):null,X.isVisible(`status`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`需求状态`,(0,M.jsx)(A,{...Q.resizeProps(`status`)})]}):null,!t&&X.isVisible(`project`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,M.jsx)(A,{...Q.resizeProps(`project`)})]}):null,X.isVisible(`iteration`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,M.jsx)(A,{...Q.resizeProps(`iteration`)})]}):null,X.isVisible(`createdAt`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`创建日期`,(0,M.jsx)(A,{...Q.resizeProps(`createdAt`)})]}):null,X.isVisible(`updatedAt`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`修改日期`,(0,M.jsx)(A,{...Q.resizeProps(`updatedAt`)})]}):null,(0,M.jsx)(`th`,{"aria-hidden":`true`}),(0,M.jsx)(`th`,{className:xe,children:`操作`})]})}),(0,M.jsxs)(`tbody`,{children:[f&&!s.requirements.length?(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:Z.length,className:`px-4 py-16 text-center`,children:(0,M.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):lt.length===0?(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:Z.length,children:ot?(0,M.jsx)(me,{children:`没有符合筛选条件的需求。`}):(0,M.jsx)(ge,{icon:`file`,title:`暂无需求`,hint:`拆出第一条需求,再关联迭代、补充描述。`,action:(0,M.jsxs)(`button`,{type:`button`,onClick:()=>W(Ke(F===`all`?``:F)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,M.jsx)(E,{name:`plus`,size:13}),`新建需求`]})})})}):null,lt.map(e=>(0,M.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,M.jsx)(`td`,{className:`${De} font-mono text-xs text-stone-400`,children:e.autoId}),(0,M.jsx)(`td`,{className:Te,style:{"--tw-sticky-left":`${tt}px`},children:(0,M.jsx)(ae,{text:e.title,onClick:()=>W({id:e.id,projectId:e.projectId,iterationId:e.iterationId,title:e.title,priority:e.priority,status:e.status,description:e.description,acceptanceCriteria:e.acceptanceCriteria.map(e=>({...e})),githubIssue:e.githubIssue,attachment:e.attachment})})}),X.isVisible(`priority`)?(0,M.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,M.jsx)(ce,{tone:_e[e.priority],children:v[e.priority]})}):null,X.isVisible(`status`)?(0,M.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,M.jsx)(o,{unstyled:!0,fitContent:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:G,options:N,value:e.status,onChange:t=>void pt(e,t),renderOptionPrefix:e=>(0,M.jsx)(D,{tone:x[e.value]}),renderTrigger:()=>(0,M.jsx)(ce,{tone:x[e.status],children:m[e.status]})})}):null,!t&&X.isVisible(`project`)?(0,M.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,M.jsx)(`a`,{href:oe(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:it(e.projectId)})}):null,X.isVisible(`iteration`)?(0,M.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:at(e.iterationId)}):null,X.isVisible(`createdAt`)?(0,M.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:b(e.createdAt)}):null,X.isVisible(`updatedAt`)?(0,M.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:b(e.updatedAt)}):null,(0,M.jsx)(`td`,{"aria-hidden":`true`}),(0,M.jsx)(`td`,{className:Ce,children:(0,M.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:G,onClick:()=>J(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,M.jsx)(E,{name:`trash`,size:15})})})]},e.id))]})]})}),$.length>0?(0,M.jsx)(ee,{page:ct,totalPages:st,pageSize:H,busy:G,onPage:V,onPageSize:e=>{Ze(e),V(1)}}):null]}),(0,M.jsx)(ue,{open:U!==null,title:U?.id?`编辑需求`:`新建需求`,busy:G,submitLabel:U?.id?`保存`:`创建`,onClose:()=>ft(),onSubmit:()=>void dt(),children:U?(0,M.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,M.jsx)(C,{label:`所属项目`,required:!0,children:(0,M.jsx)(O,{ariaLabel:`所属项目`,options:s.projects.map(e=>({value:e.id,label:e.name})),value:U.projectId,onChange:e=>{let t=s.iterations.some(t=>t.id===U.iterationId&&t.projectId===e);W({...U,projectId:e,iterationId:t?U.iterationId:``})}})}),(0,M.jsx)(C,{label:`所属迭代`,children:(0,M.jsx)(O,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...ut.map(e=>({value:e.id,label:e.name}))],value:U.iterationId,onChange:e=>W({...U,iterationId:e}),disabled:ut.length===0})}),(0,M.jsx)(C,{label:`需求描述`,required:!0,children:(0,M.jsx)(`textarea`,{autoFocus:!0,value:U.title,onChange:e=>W({...U,title:e.target.value}),placeholder:`一句话写清要做什么`,rows:3,className:le})}),(0,M.jsx)(C,{label:`优先级`,children:(0,M.jsx)(O,{ariaLabel:`优先级`,options:Ge,value:U.priority,onChange:e=>W({...U,priority:e}),renderOptionPrefix:e=>(0,M.jsx)(D,{tone:_e[e.value]})})}),(0,M.jsx)(C,{label:`需求状态`,children:(0,M.jsx)(O,{ariaLabel:`需求状态`,options:N,value:U.status,onChange:e=>W({...U,status:e}),renderOptionPrefix:e=>(0,M.jsx)(D,{tone:x[e.value]})})}),(0,M.jsx)(C,{label:`附件`,children:(0,M.jsx)(ke,{value:U.attachment,onChange:e=>W(t=>t&&{...t,attachment:e}),entity:`requirements`,recordId:U.id??``,seenUrls:Y,onError:_,onPersisted:()=>void y(!0)})}),(0,M.jsx)(C,{label:`备注`,children:(0,M.jsx)(`textarea`,{value:U.description,onChange:e=>W({...U,description:e.target.value}),placeholder:`补充背景、目标与范围(可选)`,rows:4,className:le})}),U.id?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(C,{label:`创建日期`,children:(0,M.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:b(s.requirements.find(e=>e.id===U.id)?.createdAt)})}),(0,M.jsx)(C,{label:`修改日期`,children:(0,M.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:b(s.requirements.find(e=>e.id===U.id)?.updatedAt)})})]}):null]}):null}),(0,M.jsx)(i,{open:q!==null,title:`删除需求`,message:`确定删除「${q?.title??``}」?关联的缺陷会保留,但不再关联到这条需求。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>J(null),onConfirm:()=>void mt()})]})}export{P as t};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.BRvXWHLe.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./ConfirmDialog.DrrPf1MB.js";import{n as a,t as ee}from"./DocsPager.Duf4I68E.js";import{t as o}from"./SelectDropdown.T3CKHaLt.js";import{A as s,D as c,F as l,P as u,R as d,b as f,d as p,f as m,g as te,h,j as g,l as _,m as ne,u as v,w as re,z as y}from"./pm.BXmOiFfW.js";import{A as ie,C as ae,D as oe,E as b,O as se,S as ce,T as x,_ as S,a as le,c as ue,d as de,f as C,g as fe,h as w,j as pe,k as T,l as me,m as E,p as he,s as D,u as ge,w as _e,y as O}from"./PmShared.BK8kWRSV.js";import{n as ve,r as ye,t as be}from"./TableFieldConfig.C7O-mL-p.js";import{showToast as k}from"./Toast.BO2NFckG.js";import{c as xe,d as Se,i as Ce,l as we,n as Te,o as Ee,r as De,s as Oe,t as A}from"./ColumnResize.CkE59sGq.js";var j=e(t(),1),M=r();function ke({value:e,onChange:t,entity:n,recordId:r=``,seenUrls:i,onError:a,onPersisted:ee}){let o=g(e),[l,u]=(0,j.useState)(!1),[p,m]=(0,j.useState)(!1),[te,h]=(0,j.useState)(null),_=(0,j.useRef)(null);(0,j.useEffect)(()=>{for(let t of g(e))i.current.add(t.url)},[e,i]);let v=(0,j.useCallback)(async n=>{if(n&&n.length){u(!0);try{let r=await y(Array.from(n));t(s([...g(e),...r])),a(``)}catch(e){a(e instanceof Error?e.message:String(e))}finally{u(!1),_.current&&(_.current.value=``)}}},[t,a,e]);(0,j.useEffect)(()=>{let e=e=>{let t=f(e.clipboardData);t.length&&(e.preventDefault(),v(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[v]);async function re(e){let i=s(o.filter(t=>t.url!==e));if(r)try{await d(n,r,{attachment:i}),ee?.()}catch(e){a(e instanceof Error?e.message:String(e));return}t(i),ne([e],r)}return(0,M.jsxs)(`div`,{className:`space-y-2 rounded-lg transition-colors ${p?`bg-[#3370ff]/5 ring-1 ring-[#3370ff]/40`:``}`,onDragOver:e=>{e.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:e=>{e.preventDefault(),m(!1),v(e.dataTransfer?.files??null)},children:[o.length?(0,M.jsx)(`ul`,{className:`space-y-1.5`,children:o.map(e=>(0,M.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[c(e.url)?(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,M.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,M.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,M.jsx)(E,{name:`file`,size:15})}),c(e.url)?(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,M.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>void re(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url))}):null,(0,M.jsx)(`input`,{ref:_,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void v(e.target.files)}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>_.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,M.jsx)(E,{name:l?`file`:`plus`,size:13}),l?`上传中…`:`上传文件 / 图片`]}),(0,M.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可拖拽到这里,或直接粘贴截图(⌘V / Ctrl+V),支持多张`})]}),(0,M.jsx)(w,{file:te,onClose:()=>h(null)})]})}var Ae=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`priority`,width:100,min:80},{key:`status`,width:120,min:96}],je={key:`project`,width:140,min:100},Me=[{key:`iteration`,width:120,min:88},{key:`createdAt`,width:140,min:110},{key:`updatedAt`,width:140,min:110},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],Ne=new Set([`id`,`title`,`filler`,`action`]),Pe=[{key:`priority`,label:`优先级`},{key:`status`,label:`需求状态`},{key:`iteration`,label:`所属迭代`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Fe=`pm.requirements.fields`,Ie=20,Le=`tw.pm-requirements.page-size.v1`,Re=[`all`,...p],ze=[`all`,..._],Be=`pm.requirements.project`,Ve=`pm.requirements.iteration`,He=`pm.requirements.status`,Ue=`pm.requirements.priority`,We=`pm.requirements.keyword`,Ge=_.map(e=>({value:e,label:v[e]})),N=p.map(e=>({value:e,label:m[e]}));function Ke(e=``){return{projectId:e,iterationId:``,title:``,priority:`medium`,status:`pending`,description:``,acceptanceCriteria:[],githubIssue:``,attachment:``}}function P({scopeProjectId:e=``}={}){let t=!!e,r=ie(`pmRequirements`),{store:s,live:c,loading:f,error:p,setError:_,reload:y}=pe(),[w,P]=T(Be,`all`),F=e||w,[I,L]=T(Ve,`all`),[R,qe]=se(He,Re,`all`),[z,Je]=se(Ue,ze,`all`),[B,Ye]=T(We),[Xe,V]=(0,j.useState)(1),[H,Ze]=a(Ie,Le),[U,W]=(0,j.useState)(null),[G,K]=(0,j.useState)(!1),[q,J]=(0,j.useState)(null),Y=(0,j.useRef)(new Set),Qe=(0,j.useMemo)(()=>t?Pe:[{key:`project`,label:`所属项目`},...Pe],[t]),X=ye(Fe,Qe,Ne),$e=(0,j.useMemo)(()=>t?[...Ae,...Me]:[...Ae,je,...Me],[t]),Z=(0,j.useMemo)(()=>ve($e,X.isVisible),[$e,X.isVisible]),Q=we(t?`pm.requirements.cols.scoped.v2`:`pm.requirements.cols.v2`,Z),et=Se(t?`pm.requirements.scroll.scoped`:`pm.requirements.scroll`),tt=Q.widthOf(`id`)??88,nt=(0,j.useMemo)(()=>[{value:`all`,label:`全部项目`},...s.projects.map(e=>({value:e.id,label:e.name}))],[s.projects]),rt=(0,j.useMemo)(()=>[{value:`all`,label:`全部迭代`},...u(s.iterations.filter(e=>F===`all`||e.projectId===F)).map(e=>({value:e.id,label:e.name}))],[s.iterations,F]),it=(0,j.useMemo)(()=>{let e=new Map(s.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[s.projects]),at=(0,j.useMemo)(()=>{let e=new Map(s.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[s.iterations]),$=(0,j.useMemo)(()=>l(re(s.requirements,{projectId:F,iterationId:I,status:R,priority:z,keyword:B})),[s.requirements,F,I,R,z,B]),ot=t?s.requirements.filter(e=>e.projectId===F).length:s.requirements.length,st=Math.max(1,Math.ceil($.length/H)),ct=Math.min(Xe,st),lt=$.slice((ct-1)*H,ct*H);(0,j.useEffect)(()=>{t||c===!0&&w!==`all`&&!s.projects.some(e=>e.id===w)&&P(`all`)},[c,s.projects,w,P,t]),(0,j.useEffect)(()=>{c===!0&&I!==`all`&&!s.iterations.some(e=>e.id===I&&(F===`all`||e.projectId===F))&&L(`all`)},[c,s.iterations,F,I,L]);let ut=U?u(s.iterations.filter(e=>e.projectId===U.projectId)):[];async function dt(){if(!U)return;if(!U.projectId){_(`请先选择所属项目`);return}let e=U.title.trim();if(!e)_(`需求描述不能为空`);else{K(!0);try{let t={projectId:U.projectId,iterationId:U.iterationId,title:e,priority:U.priority,status:U.status,description:U.description,acceptanceCriteria:U.acceptanceCriteria.filter(e=>e.text.trim()),githubIssue:U.githubIssue,attachment:U.attachment};U.id?await d(`requirements`,U.id,t):await h(`requirements`,[t]);let n=!!U.id;W(null),Y.current.clear(),_(``),await y(!0),k(n?`已保存需求`:`已新建需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);_(t),k(`保存需求失败:${t}`,`error`)}finally{K(!1)}}}function ft(){let e=[...Y.current,...g(U?.attachment??``).map(e=>e.url)];Y.current.clear(),W(null),e.length&&ne(e)}async function pt(e,t){K(!0);try{await d(`requirements`,e.id,{status:t}),await y(!0),k(`已更新需求状态为「${t}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);_(t),k(`更新状态失败:${t}`,`error`)}finally{K(!1)}}async function mt(){let e=q;if(e){J(null),K(!0);try{await te(`requirements`,[e.id]),await y(!0),k(`已删除需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);_(t),k(`删除需求失败:${t}`,`error`)}finally{K(!1)}}}if(!r.ready)return(0,M.jsx)(fe,{label:`正在读取插件开关`});if(!r.on)return(0,M.jsx)(S,{children:n(`pmRequirements`)});if(c===null)return(0,M.jsx)(fe,{label:`正在连接项目管理服务`});if(!c)return(0,M.jsx)(S,{children:`需求管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(s.projects.length===0&&!f&&!t)return(0,M.jsx)(S,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护需求。`});let ht=[{value:`all`,label:`全部`},...N];return(0,M.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,M.jsx)(`span`,{className:`font-medium text-stone-600`,children:ot}),` 条需求`,$.length===ot?``:` · 筛选出 ${$.length} 条`]}),(0,M.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,M.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选需求`,className:`w-36`,options:nt,value:w,onChange:e=>{P(e),L(`all`),V(1)}}),(0,M.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选需求`,className:`w-32`,options:rt,value:I,onChange:e=>{L(e),V(1)}}),(0,M.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按优先级筛选需求`,className:`w-28`,options:[{value:`all`,label:`全部优先级`},...Ge],value:z,onChange:e=>{Je(e),V(1)}}),(0,M.jsxs)(`label`,{className:`relative block`,children:[(0,M.jsx)(E,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,M.jsx)(`input`,{value:B,onChange:e=>{Ye(e.target.value),V(1)},placeholder:`搜索编号 / 名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,M.jsx)(be,{fields:X.fields,isVisible:X.isVisible,onToggle:X.toggle}),(0,M.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>W(Ke(F===`all`?``:F)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,M.jsx)(E,{name:`plus`,size:14}),`新建需求`]})]})]}),(0,M.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,M.jsx)(he,{ariaLabel:`按状态筛选需求`,options:ht,value:R,onChange:e=>{qe(e),V(1)}})}),p?(0,M.jsx)(de,{message:p,onClose:()=>_(``)}):null,(0,M.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,M.jsx)(`div`,{ref:et,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,M.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:Q.tableStyle,children:[(0,M.jsx)(`colgroup`,{children:Z.map(e=>(0,M.jsx)(`col`,{style:Q.widthOf(e.key)?{width:Q.widthOf(e.key)}:void 0},e.key))}),(0,M.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,M.jsxs)(`tr`,{children:[(0,M.jsxs)(`th`,{className:`${Oe} relative`,children:[`ID`,(0,M.jsx)(A,{...Q.resizeProps(`id`)})]}),(0,M.jsxs)(`th`,{className:Ee,style:{"--tw-sticky-left":`${tt}px`},children:[`需求描述`,(0,M.jsx)(A,{...Q.resizeProps(`title`)})]}),X.isVisible(`priority`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`优先级`,(0,M.jsx)(A,{...Q.resizeProps(`priority`)})]}):null,X.isVisible(`status`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`需求状态`,(0,M.jsx)(A,{...Q.resizeProps(`status`)})]}):null,!t&&X.isVisible(`project`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,M.jsx)(A,{...Q.resizeProps(`project`)})]}):null,X.isVisible(`iteration`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,M.jsx)(A,{...Q.resizeProps(`iteration`)})]}):null,X.isVisible(`createdAt`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`创建日期`,(0,M.jsx)(A,{...Q.resizeProps(`createdAt`)})]}):null,X.isVisible(`updatedAt`)?(0,M.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`修改日期`,(0,M.jsx)(A,{...Q.resizeProps(`updatedAt`)})]}):null,(0,M.jsx)(`th`,{"aria-hidden":`true`}),(0,M.jsx)(`th`,{className:xe,children:`操作`})]})}),(0,M.jsxs)(`tbody`,{children:[f&&!s.requirements.length?(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:Z.length,className:`px-4 py-16 text-center`,children:(0,M.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):lt.length===0?(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:Z.length,children:ot?(0,M.jsx)(me,{children:`没有符合筛选条件的需求。`}):(0,M.jsx)(ge,{icon:`file`,title:`暂无需求`,hint:`拆出第一条需求,再关联迭代、补充描述。`,action:(0,M.jsxs)(`button`,{type:`button`,onClick:()=>W(Ke(F===`all`?``:F)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,M.jsx)(E,{name:`plus`,size:13}),`新建需求`]})})})}):null,lt.map(e=>(0,M.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,M.jsx)(`td`,{className:`${De} font-mono text-xs text-stone-400`,children:e.autoId}),(0,M.jsx)(`td`,{className:Te,style:{"--tw-sticky-left":`${tt}px`},children:(0,M.jsx)(ae,{text:e.title,onClick:()=>W({id:e.id,projectId:e.projectId,iterationId:e.iterationId,title:e.title,priority:e.priority,status:e.status,description:e.description,acceptanceCriteria:e.acceptanceCriteria.map(e=>({...e})),githubIssue:e.githubIssue,attachment:e.attachment})})}),X.isVisible(`priority`)?(0,M.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,M.jsx)(ce,{tone:_e[e.priority],children:v[e.priority]})}):null,X.isVisible(`status`)?(0,M.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,M.jsx)(o,{unstyled:!0,fitContent:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:G,options:N,value:e.status,onChange:t=>void pt(e,t),renderOptionPrefix:e=>(0,M.jsx)(D,{tone:x[e.value]}),renderTrigger:()=>(0,M.jsx)(ce,{tone:x[e.status],children:m[e.status]})})}):null,!t&&X.isVisible(`project`)?(0,M.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,M.jsx)(`a`,{href:oe(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:it(e.projectId)})}):null,X.isVisible(`iteration`)?(0,M.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:at(e.iterationId)}):null,X.isVisible(`createdAt`)?(0,M.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:b(e.createdAt)}):null,X.isVisible(`updatedAt`)?(0,M.jsx)(`td`,{className:`whitespace-nowrap px-2 py-1 align-middle text-xs text-stone-500`,children:b(e.updatedAt)}):null,(0,M.jsx)(`td`,{"aria-hidden":`true`}),(0,M.jsx)(`td`,{className:Ce,children:(0,M.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:G,onClick:()=>J(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,M.jsx)(E,{name:`trash`,size:15})})})]},e.id))]})]})}),$.length>0?(0,M.jsx)(ee,{page:ct,totalPages:st,pageSize:H,busy:G,onPage:V,onPageSize:e=>{Ze(e),V(1)}}):null]}),(0,M.jsx)(ue,{open:U!==null,title:U?.id?`编辑需求`:`新建需求`,busy:G,submitLabel:U?.id?`保存`:`创建`,onClose:()=>ft(),onSubmit:()=>void dt(),children:U?(0,M.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,M.jsx)(C,{label:`所属项目`,required:!0,children:(0,M.jsx)(O,{ariaLabel:`所属项目`,options:s.projects.map(e=>({value:e.id,label:e.name})),value:U.projectId,onChange:e=>{let t=s.iterations.some(t=>t.id===U.iterationId&&t.projectId===e);W({...U,projectId:e,iterationId:t?U.iterationId:``})}})}),(0,M.jsx)(C,{label:`所属迭代`,children:(0,M.jsx)(O,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...ut.map(e=>({value:e.id,label:e.name}))],value:U.iterationId,onChange:e=>W({...U,iterationId:e}),disabled:ut.length===0})}),(0,M.jsx)(C,{label:`需求描述`,required:!0,children:(0,M.jsx)(`textarea`,{autoFocus:!0,value:U.title,onChange:e=>W({...U,title:e.target.value}),placeholder:`一句话写清要做什么`,rows:3,className:le})}),(0,M.jsx)(C,{label:`优先级`,children:(0,M.jsx)(O,{ariaLabel:`优先级`,options:Ge,value:U.priority,onChange:e=>W({...U,priority:e}),renderOptionPrefix:e=>(0,M.jsx)(D,{tone:_e[e.value]})})}),(0,M.jsx)(C,{label:`需求状态`,children:(0,M.jsx)(O,{ariaLabel:`需求状态`,options:N,value:U.status,onChange:e=>W({...U,status:e}),renderOptionPrefix:e=>(0,M.jsx)(D,{tone:x[e.value]})})}),(0,M.jsx)(C,{label:`附件`,children:(0,M.jsx)(ke,{value:U.attachment,onChange:e=>W(t=>t&&{...t,attachment:e}),entity:`requirements`,recordId:U.id??``,seenUrls:Y,onError:_,onPersisted:()=>void y(!0)})}),(0,M.jsx)(C,{label:`备注`,children:(0,M.jsx)(`textarea`,{value:U.description,onChange:e=>W({...U,description:e.target.value}),placeholder:`补充背景、目标与范围(可选)`,rows:4,className:le})}),U.id?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(C,{label:`创建日期`,children:(0,M.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:b(s.requirements.find(e=>e.id===U.id)?.createdAt)})}),(0,M.jsx)(C,{label:`修改日期`,children:(0,M.jsx)(`div`,{className:`px-0.5 py-1.5 text-sm text-stone-500`,children:b(s.requirements.find(e=>e.id===U.id)?.updatedAt)})})]}):null]}):null}),(0,M.jsx)(i,{open:q!==null,title:`删除需求`,message:`确定删除「${q?.title??``}」?关联的缺陷会保留,但不再关联到这条需求。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>J(null),onConfirm:()=>void mt()})]})}export{P as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DkyjuL-S.js";import{i as r,o as i}from"./plugins.BRvXWHLe.js";import{n as a,o,r as s,s as c}from"./view-prefs.DhdLZjGh.js";import{t as l}from"./react-dom.DLW9pGCF.js";import{t as u}from"./jsx-runtime.DUg_B_vD.js";import{t as d}from"./OverflowHint.CHZeFfUj.js";import{t as f}from"./SelectDropdown.T3CKHaLt.js";import{_ as p,v as m,y as h}from"./pm.BXmOiFfW.js";var g=e(t(),1),_=e(l(),1),v=u(),y=280;function b({open:e,onClose:t,title:n,closeAriaLabel:r=`关闭面板`,widthClass:i=`max-w-md`,escDisabled:a=!1,bodyClassName:o,children:s,footer:c}){let[l,u]=(0,g.useState)(e),[d,f]=(0,g.useState)(!1);if((0,g.useEffect)(()=>{if(e){u(!0);let e=window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>f(!0))});return()=>window.cancelAnimationFrame(e)}f(!1);let t=window.setTimeout(()=>u(!1),y);return()=>window.clearTimeout(t)},[e]),(0,g.useEffect)(()=>{if(!e||a)return;function n(e){e.key===`Escape`&&(document.querySelector(`[aria-haspopup="listbox"][aria-expanded="true"]`)||document.querySelector(`[data-pm-image-preview]`)||(e.preventDefault(),e.stopPropagation(),t()))}return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,t,a]),!l)return null;let p=(0,v.jsxs)(`div`,{className:`fixed inset-0 z-60 flex justify-end`,role:`dialog`,"aria-modal":`true`,children:[(0,v.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-stone-900/30 transition-opacity duration-[280ms] ease-out ${d?`opacity-100`:`opacity-0`}`,"aria-label":r,onClick:t}),(0,v.jsxs)(`aside`,{className:`tw-slide-over relative w-full ${i} h-full shadow-2xl border-l border-stone-200 flex flex-col transition-[translate] duration-[280ms] ease-[cubic-bezier(0.32,0.72,0,1)] will-change-[translate] ${d?`translate-x-0`:`translate-x-full`}`,children:[(0,v.jsxs)(`header`,{className:`shrink-0 h-12 px-4 border-b border-stone-100 flex items-center gap-2`,children:[(0,v.jsx)(`h2`,{className:`tw-slide-over-title text-sm font-semibold text-stone-800 flex-1`,children:n}),(0,v.jsx)(`button`,{type:`button`,onClick:t,className:`tw-icon-btn w-8 h-8 rounded-lg`,"data-hint":`关闭(Esc)`,children:`✕`})]}),(0,v.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 ${o??`space-y-4`}`.trim(),children:s}),c]})]});return typeof document>`u`?p:(0,_.createPortal)(p,document.body)}var x=8e3;function S(e,t,n){let[r,i]=(0,g.useState)(()=>a(e,t,n));return[r,(0,g.useCallback)(t=>{i(t),o(e,t)},[e])]}function C(e,t=``){let[n,r]=(0,g.useState)(()=>s(e)||t);return[n,(0,g.useCallback)(n=>{r(n),c(e,n===t?``:n)},[e,t])]}function w(e){let[t,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(()=>r(e));return(0,g.useEffect)(()=>{let t=!0,o=i(()=>s(r(e)));return n().then(()=>{t&&(s(r(e)),a(!0))}),()=>{t=!1,o()}},[e]),{ready:t,on:o}}var T=(0,g.createContext)(null);function E(e){let[t,n]=(0,g.useState)(p),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(``),l=(0,g.useRef)(!0),u=(0,g.useCallback)(async(e=!1)=>{e||o(!0);try{let e=await h();return l.current?(n(e),i(!0),c(``),e):null}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}finally{l.current&&!e&&o(!1)}},[]);return(0,g.useEffect)(()=>{if(!e){o(!1);return}l.current=!0;let t=null;return(async()=>{let e=await m();l.current&&(e?(await u(),l.current&&(i(!0),t=window.setInterval(()=>void u(!0),x))):(i(!1),o(!1)))})(),()=>{l.current=!1,t!==null&&window.clearInterval(t)}},[e,u]),{store:t,live:r,loading:a,error:s,setError:c,reload:u}}function D({children:e}){let t=E(!0);return(0,v.jsx)(T.Provider,{value:t,children:e})}function O(){let e=(0,g.useContext)(T),t=E(e===null);return e??t}var k={gray:`bg-stone-100 text-stone-600`,blue:`bg-[#e1eaff] text-[#1f4ec2]`,amber:`bg-[#fff1e3] text-[#a85b00]`,yellow:`bg-[#fff7d6] text-[#8a6100]`,red:`bg-[#fee4e3] text-[#c02a26]`,purple:`bg-[#efe7ff] text-[#5b32b4]`,green:`bg-[#d9f5d2] text-[#1d7a12]`,muted:`bg-stone-100 text-stone-400`},A={planning:`blue`,in_progress:`amber`,archived:`gray`},j={planning:`blue`,in_progress:`amber`,done:`green`},M={urgent:`red`,high:`amber`,medium:`yellow`,low:`gray`},N={pending:`gray`,todo:`blue`,in_progress:`blue`,testing:`purple`,done:`green`,cancelled:`muted`},P={critical:`red`,major:`amber`,minor:`yellow`,trivial:`gray`},F={pending:`gray`,todo:`blue`,fixed:`amber`,verifying:`purple`,passed:`green`,cancelled:`muted`},I={gray:`#a8a29e`,blue:`#3370ff`,amber:`#f59e0b`,yellow:`#eab308`,red:`#ef4444`,purple:`#8b5cf6`,green:`#22c55e`,muted:`#d6d3d1`};function L({tone:e}){return(0,v.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:I[e]}})}function ee({tone:e,children:t}){return(0,v.jsx)(`span`,{className:`inline-flex h-6 shrink-0 items-center rounded-md px-2 text-xs font-medium ${k[e]}`,children:t})}var R={plus:[`M12 5v14`,`M5 12h14`],more:[],chevronRight:[`m9 5 7 7-7 7`],chevronDown:[`m5 9 7 7 7-7`],arrowLeft:[`M19 12H5`,`m11 18-6-6 6-6`],pencil:[`M12 20h9`,`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`],trash:[`M3 6h18`,`M8 6V4h8v2`,`M19 6l-1 14H6L5 6`,`M10 11v6`,`M14 11v6`],copy:[`M9 9.5A1.5 1.5 0 0 1 10.5 8h7A1.5 1.5 0 0 1 19 9.5v7A1.5 1.5 0 0 1 17.5 18h-7A1.5 1.5 0 0 1 9 16.5Z`,`M5 15V5.5A1.5 1.5 0 0 1 6.5 4H15`],check:[`m4.5 12.5 5 5 10-11`],play:[`M8 5.5v13l11-6.5Z`],search:[`M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14Z`,`m20 20-3.6-3.6`],folder:[`M3 7.5A2.5 2.5 0 0 1 5.5 5h3.2l2 2h7.8A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5Z`],calendar:[`M4 7.5A2.5 2.5 0 0 1 6.5 5h11A2.5 2.5 0 0 1 20 7.5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z`,`M8 3v4`,`M16 3v4`,`M4 10h16`],file:[`M7 3.5h6.5L18 8v12.5H7Z`,`M13.5 3.5V8H18`,`M10 12.5h5`,`M10 16h5`],bug:[`M8.5 9.5h7V14a3.5 3.5 0 0 1-7 0Z`,`M9.5 6.2 12 8l2.5-1.8`,`M4.5 13H8.5`,`M15.5 13h4`,`M6 18.5l2-2`,`M18 18.5l-2-2`],chat:[`M4 6.5A2.5 2.5 0 0 1 6.5 4h11A2.5 2.5 0 0 1 20 6.5v7a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 3.5V16H6.5A2.5 2.5 0 0 1 4 13.5Z`],terminal:[`m5 8 4 4-4 4`,`M13 16h6`],paste:[`M9 3.5h6v2.5H9Z`,`M8 4.8H6.6A1.6 1.6 0 0 0 5 6.4v12.5a1.6 1.6 0 0 0 1.6 1.6h10.8a1.6 1.6 0 0 0 1.6-1.6V6.4a1.6 1.6 0 0 0-1.6-1.6H16`,`M8.5 11h7`,`M8.5 15h7`],download:[`M12 4v10`,`m7.5 10 4.5 4.5 4.5-4.5`,`M5 20h14`],sliders:[`M4 8h6`,`M14 8h6`,`M4 16h10`,`M18 16h2`,`M10 8a2 2 0 1 0 4 0 2 2 0 1 0-4 0`,`M14 16a2 2 0 1 0 4 0 2 2 0 1 0-4 0`]};function z({name:e,size:t=16,className:n=``}){return e===`more`?(0,v.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`currentColor`,"aria-hidden":`true`,className:n,children:[(0,v.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.6`}),(0,v.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,v.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.6`})]}):(0,v.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:n,children:R[e].map(e=>(0,v.jsx)(`path`,{d:e},e))})}function B({tabs:e,value:t,onChange:n,ariaLabel:r}){return(0,v.jsx)(`div`,{className:`tw-pm-tabs`,role:`tablist`,"aria-label":r,children:e.map(e=>(0,v.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.value,onClick:()=>n(e.value),className:`tw-pm-tab`,children:[e.label,typeof e.count==`number`?(0,v.jsx)(`span`,{className:`tw-pm-tab-count`,children:e.count}):null]},e.value))})}function V({options:e,value:t,onChange:n,ariaLabel:r}){return(0,v.jsx)(`div`,{className:`tw-pm-pills`,role:`group`,"aria-label":r,children:e.map(e=>(0,v.jsx)(`button`,{type:`button`,"aria-pressed":t===e.value,onClick:()=>n(e.value),children:e.label},e.value))})}function H({icon:e,title:t,hint:n,action:r}){return(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-4 py-20 text-center`,children:[(0,v.jsx)(`span`,{className:`tw-pm-tile mb-4 flex h-16 w-16 items-center justify-center rounded-2xl`,children:(0,v.jsx)(z,{name:e,size:30})}),(0,v.jsx)(`p`,{className:`text-sm font-medium text-stone-600`,children:t}),(0,v.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:n}),r?(0,v.jsx)(`div`,{className:`mt-4`,children:r}):null]})}function U(e){return`/pm/projects/detail/?id=${encodeURIComponent(e)}`}var W=`h-9 w-full rounded-md border border-transparent bg-transparent px-2 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-400`,G=`min-h-[72px] w-full resize-y rounded-md border border-stone-200 bg-white px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff] placeholder:text-stone-400`;function K(e){return(0,v.jsx)(f,{flat:!0,menuMatchTrigger:!0,ariaLabel:e.ariaLabel,options:e.options,value:e.value,onChange:e.onChange,disabled:e.disabled,renderOptionPrefix:e.renderOptionPrefix})}function q({page:e,totalPages:t,busy:n=!1,onPage:r}){let i=`h-7 shrink-0 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-40`;return(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-center gap-2 pt-3`,children:[(0,v.jsx)(`button`,{type:`button`,className:i,disabled:n||e<=1,onClick:()=>r(e-1),children:`上一页`}),(0,v.jsxs)(`span`,{className:`px-2 text-xs tabular-nums text-stone-400`,children:[e,` / `,t]}),(0,v.jsx)(`button`,{type:`button`,className:i,disabled:n||e>=t,onClick:()=>r(e+1),children:`下一页`})]})}function J({label:e}){return(0,v.jsx)(`div`,{className:`flex min-h-[240px] items-center justify-center rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":e,children:(0,v.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}function Y({children:e}){return(0,v.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:e})}function X({children:e}){return(0,v.jsx)(`div`,{className:`px-4 py-16 text-center text-sm text-stone-400`,children:e})}function Z({open:e,title:t,busy:n,submitLabel:r,onClose:i,onSubmit:a,children:o}){return(0,v.jsx)(b,{open:e,onClose:i,title:t,footer:(0,v.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-stone-100 px-2 py-3`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 rounded-lg border border-stone-200 px-3 text-sm text-stone-600 hover:bg-stone-100`,children:`取消`}),(0,v.jsx)(`button`,{type:`button`,disabled:n,onClick:a,className:`h-8 rounded-lg bg-[#3370ff] px-3 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:r})]}),children:o})}function Q({label:e,required:t,children:n}){return(0,v.jsxs)(`div`,{className:`flex items-start gap-3 px-2 py-2`,children:[(0,v.jsx)(`div`,{className:`flex h-9 w-[88px] shrink-0 items-center text-sm text-stone-600`,children:(0,v.jsxs)(`span`,{className:`truncate`,children:[e,t?(0,v.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`}):null]})}),(0,v.jsx)(`div`,{className:`min-w-0 flex-1 [&>div]:mt-0`,children:n})]})}var $=180;function te({file:e,onClose:t}){let n=!!e,[r,i]=(0,g.useState)(n),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(e);return(0,g.useEffect)(()=>{if(e){c(e),i(!0);let t=window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>o(!0))});return()=>window.cancelAnimationFrame(t)}o(!1);let t=window.setTimeout(()=>{i(!1),c(null)},$);return()=>window.clearTimeout(t)},[e]),(0,g.useEffect)(()=>{if(!n)return;function e(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())}return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n,t]),!r||!s?null:(0,_.createPortal)((0,v.jsxs)(`div`,{"data-pm-image-preview":``,className:`fixed inset-0 z-[70] flex items-center justify-center p-6 sm:p-10`,role:`dialog`,"aria-modal":`true`,"aria-label":s.name,onClick:t,children:[(0,v.jsx)(`div`,{className:`absolute inset-0 bg-stone-900/70 transition-opacity duration-[180ms] ease-out ${a?`opacity-100`:`opacity-0`}`,"aria-hidden":`true`}),(0,v.jsx)(`img`,{src:s.url,alt:s.name,className:`relative max-h-full max-w-full rounded-lg bg-white object-contain shadow-2xl transition-[opacity,scale] duration-[180ms] ease-out ${a?`scale-100 opacity-100`:`scale-95 opacity-0`}`,onClick:e=>e.stopPropagation()}),(0,v.jsx)(`button`,{type:`button`,"aria-label":`关闭预览`,onClick:t,className:`absolute right-4 top-4 flex h-9 w-9 items-center justify-center rounded-full bg-white/90 text-lg text-stone-600 shadow-md transition-opacity duration-[180ms] ease-out hover:bg-white hover:text-stone-900 ${a?`opacity-100`:`opacity-0`}`,children:`✕`})]}),document.body)}function ne({message:e,onClose:t}){return(0,v.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,v.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,v.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]})}function re(e){let t=(e??``).trim();if(!t)return`—`;let n=Date.parse(t);if(!Number.isFinite(n)){let e=t.slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.replace(/-/g,`/`):`—`}let r=new Date(n);return`${r.getFullYear()}/${String(r.getMonth()+1).padStart(2,`0`)}/${String(r.getDate()).padStart(2,`0`)} ${String(r.getHours()).padStart(2,`0`)}:${String(r.getMinutes()).padStart(2,`0`)}`}function ie({text:e,onClick:t}){let n=(0,v.jsx)(d,{text:e,className:`block min-w-0 truncate text-sm text-stone-800 group-hover/pm-title:text-[#3370ff]`});return t?(0,v.jsx)(`button`,{type:`button`,onClick:t,className:`group/pm-title block min-w-0 max-w-full text-left`,children:n}):n}export{w as A,ie as C,U as D,re as E,b as M,S as O,ee as S,N as T,Y as _,G as a,D as b,Z as c,ne as d,Q as f,J as g,te as h,W as i,O as j,C as k,X as l,z as m,F as n,A as o,V as p,j as r,L as s,P as t,H as u,q as v,M as w,B as x,K as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./dialog.DZHZCe_T.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./OverflowHint.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./dialog.DZHZCe_T.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./OverflowHint.CHZeFfUj.js";var c=e(t(),1),l=o(),u=`bg-[var(--tw-surface-panel)] border-[var(--tw-border)]`,d=`text-[var(--tw-label-primary)]`,f=`text-[var(--tw-label-secondary)]`,p=`text-[var(--tw-label-tertiary)]`,m=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg bg-[#4176e6] px-3 text-sm font-medium text-white transition-colors hover:bg-[#3566d0] disabled:cursor-not-allowed disabled:opacity-50`,h=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-[var(--tw-border)] px-3 text-sm text-[var(--tw-label-secondary)] transition-colors hover:bg-[var(--tw-session-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,g=`h-8 w-full rounded-lg border border-[var(--tw-border)] bg-[var(--tw-surface-panel)] px-2.5 text-sm text-[var(--tw-label-primary)] outline-none transition-colors placeholder:text-[var(--tw-label-tertiary)] focus:border-[#4176e6]`;function _({open:e,prompts:t,value:o,force:_=!1,onClose:v,onMount:y,onCreate:b,target:x=`项目`,createHint:S=`会按插件自带的模板生成(规划 / 探索 / 生成代码三段),之后可在「提示词管理」里改。`}){let[C,w]=(0,c.useState)(o),[T,E]=(0,c.useState)(``),[D,O]=(0,c.useState)(!1),[k,A]=(0,c.useState)(``),[j,M]=(0,c.useState)(!1),[N,P]=(0,c.useState)(``);(0,c.useEffect)(()=>{e&&(w(o),O(!1),A(``),M(!1),P(``),E(``))},[e,o]);let F=T.trim()?t.filter(e=>e.toLowerCase().includes(T.trim().toLowerCase())):t,I=e=>{w(e),M(!1),P(``),A(``)},L=()=>{w(``),M(!0),P(`我的提示词.md`),A(``)},R=()=>{M(!1),P(``),A(``),w(o)},z=async()=>{if(!D&&C){O(!0),A(``);try{await y(C)}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}}},B=async()=>{if(!b||D)return;let e=N.trim();if(!e)A(`先给新提示词起个文件名`);else{O(!0),A(``);try{await y(await b(e)),M(!1),P(``)}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}}};return(0,l.jsxs)(i,{open:e,onClose:D?()=>void 0:v,className:`relative z-110`,children:[(0,l.jsx)(a,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,l.jsxs)(n,{transition:!0,className:`tw-dialog-panel-anim flex max-h-[min(80vh,620px)] w-full max-w-xl flex-col overflow-hidden rounded-xl border shadow-xl ${u}`,children:[(0,l.jsxs)(`div`,{className:`shrink-0 border-b border-[var(--tw-border)] px-5 py-4`,children:[(0,l.jsx)(r,{className:`text-base font-semibold ${d}`,children:_?`先挂载提示词`:`挂载提示词`}),(0,l.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${f}`,children:_?`这个${x}还没有挂载提示词,选一份挂上才能开始生成;也可以先取消,稍后再挂。`:`一个${x}只挂一份提示词,换新的会立即取消上一份的引用`})]}),(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[t.length?(0,l.jsx)(`input`,{className:`${g} shrink-0`,value:T,onChange:e=>E(e.target.value),placeholder:`搜索提示词文件名`,"aria-label":`搜索提示词`,disabled:D}):null,t.length?(0,l.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto overscroll-contain rounded-lg border border-[var(--tw-border)] p-1`,children:[F.map(e=>{let t=C===e;return(0,l.jsxs)(`button`,{type:`button`,disabled:D,onClick:()=>I(e),"aria-pressed":t,className:`flex w-full min-w-0 items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed ${t?`bg-(--tw-accent-soft) font-medium text-(--tw-accent)`:`text-[var(--tw-label-primary)] hover:bg-[var(--tw-session-hover-bg)]`}`,children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-3 shrink-0 rounded-full border ${t?`border-[#4176e6] bg-[#4176e6] shadow-[inset_0_0_0_2px_var(--tw-surface-panel)]`:`border-[var(--tw-border)]`}`}),(0,l.jsx)(s,{text:e,className:`min-w-0 flex-1 truncate`})]},e)}),F.length?null:(0,l.jsxs)(`p`,{className:`px-2.5 py-6 text-center text-xs ${p}`,children:[`没有匹配「`,T.trim(),`」的提示词`]})]}):(0,l.jsx)(`p`,{className:`rounded-lg border border-dashed border-[var(--tw-border)] px-3 py-6 text-center text-xs ${p}`,children:`「提示词管理」里还没有可用的提示词,用下面的卡片新建一份再挂上。`}),b?j?(0,l.jsxs)(`div`,{className:`shrink-0 rounded-lg border border-[var(--tw-border)] p-3`,children:[(0,l.jsx)(`p`,{className:`text-xs font-medium ${d}`,children:`新建提示词并挂载`}),(0,l.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed ${f}`,children:S}),(0,l.jsx)(`input`,{className:`${g} mt-2`,value:N,autoFocus:!0,placeholder:`文件名,例如 我的登录流程.md`,"aria-label":`新提示词文件名`,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key===`Enter`&&B()}})]}):(0,l.jsxs)(`button`,{type:`button`,disabled:D,onClick:L,className:`flex w-full shrink-0 items-center gap-3 rounded-lg border border-dashed border-[var(--tw-border)] px-3 py-3 text-left transition-colors hover:border-[#4176e6] hover:bg-[var(--tw-session-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-(--tw-accent-soft) text-(--tw-accent)`,children:(0,l.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,l.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}),(0,l.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`span`,{className:`block text-sm font-medium ${d}`,children:`新建提示词并挂载`}),(0,l.jsx)(`span`,{className:`mt-0.5 block text-[11px] ${f}`,children:`按插件模板生成一份新的,建完直接挂到当前项目`})]})]}):null,k?(0,l.jsx)(`p`,{className:`mt-3 rounded-lg bg-red-50 px-3 py-2 text-[11px] leading-relaxed break-words text-red-600`,children:k}):null]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-[var(--tw-border)] px-5 py-3`,children:[_&&!j?(0,l.jsx)(`span`,{className:`mr-auto text-[11px] ${p}`,children:`不挂载时生成会被拦下`}):null,j?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`button`,{type:`button`,className:h,onClick:R,disabled:D,children:`取消`}),(0,l.jsx)(`button`,{type:`button`,className:m,onClick:()=>void B(),disabled:D||!N.trim(),children:D?`创建中…`:`创建并挂载`})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`button`,{type:`button`,className:h,onClick:v,disabled:D,children:`取消`}),(0,l.jsx)(`button`,{type:`button`,className:m,onClick:()=>void z(),disabled:D||!C||!t.length,children:D?`保存中…`:`挂载`})]})]})]})})]})}export{_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.DkyjuL-S.js";import{a as i,i as a,n as o,o as s,s as c}from"./plugins.BRvXWHLe.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.DrrPf1MB.js";import{m as u}from"./PmShared.BK8kWRSV.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{i as te}from"./case-types.DlFkbZJN.js";import{c as f,d as p,h as ne,n as m,p as re,r as ie,u as ae,v as oe}from"./project-docs.CCjtiFjB.js";import{a as se,at as ce,c as le}from"./req-analysis.B12_MGMQ.js";import{n as ue}from"./doc-roots.CO3IBiY6.js";import{a as h,c as g,d as _,f as de,i as v,l as y,o as b,s as x,u as S}from"./prompts-meta.BUGutlsk.js";import{i as fe,n as pe,r as me,t as he}from"./DocsFileBrowser.DwKBffbM.js";import{d as ge,t as _e}from"./open-docs-in-session.CRiZT022.js";import{F as ve,I as ye,i as be,r as xe}from"./case-review.TdDs1WFM.js";import{t as C}from"./NamePromptDialog.Csfnh5eM.js";import{i as Se}from"./report-prompt.B9C4cv84.js";import{t as Ce}from"./ui-auto-prompt.H9_yhau9.js";import{T as we,u as Te}from"./ui-auto.DMv940x4.js";import{f as Ee,s as De,t as Oe,y as ke}from"./story-review.D2W5tEOY.js";import{o as Ae,t as je}from"./test-reports.CuIjlEyK.js";var w=e(t(),1),T=`tw.prompts.mounted.v1`;function Me(){try{let e=sessionStorage.getItem(r(T));if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&(n[e]=r);return n}catch{return{}}}function Ne(e){try{sessionStorage.setItem(r(T),JSON.stringify(e))}catch{}}var E=l(),Pe=10;async function D(e=`.`){let{entries:t}=await f(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await D(e.path));return n}function Fe({path:e,enabled:t,mounted:n}){let r=_(e,n);if(!r)return(0,E.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,E.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=S(e)||o(r)?.name||r,a=t[r]===!0,s=b(e,n);return(0,E.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,E.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),s&&a?(0,E.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function Ie(){let e=me(`prompts`),[t,r]=(0,w.useState)(!1),[l,f]=(0,w.useState)(!0),[b,S]=(0,w.useState)(e?!0:null),[T,Ie]=(0,w.useState)(()=>e??[]),[Le,O]=(0,w.useState)(null),[k,A]=(0,w.useState)(!1),[j,M]=(0,w.useState)({}),[N,P]=(0,w.useState)(null),[F,I]=(0,w.useState)(()=>i()),[L,Re]=(0,w.useState)(()=>Me()),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(``),W=pe(T,Pe,`prompts`),G=(0,w.useRef)(!1),K=(0,w.useRef)(!1),q=(0,w.useRef)(!1),J=(0,w.useRef)(!1),Y=(0,w.useRef)(!1),X=(0,w.useCallback)(async()=>{O(null);try{let e=await D(`.`);Ie(e),fe(`prompts`,e)}catch(e){O(e instanceof Error?e.message:String(e))}},[]);(0,w.useEffect)(()=>{if(!b||F.reqAnalysis!==!0||G.current)return;let e=new Set(T.map(e=>e.name));e.has(`需求分析提示词.md`)&&e.has(`原文结构提示词.md`)||(G.current=!0,ce(!0).then(()=>X()).catch(()=>void 0))},[b,F.reqAnalysis,T,X]),(0,w.useEffect)(()=>{b&&F.storyReview===!0&&!K.current&&(T.some(e=>e.name===`用户故事审查提示词.md`)||(K.current=!0,De(!0).then(()=>X()).catch(()=>void 0)))},[b,F.storyReview,T,X]),(0,w.useEffect)(()=>{b&&F.testPoints===!0&&!q.current&&(T.some(e=>e.name===`测试点生成提示词.md`)||(q.current=!0,ke(!0).then(()=>X()).catch(()=>void 0)))},[b,F.testPoints,T,X]),(0,w.useEffect)(()=>{b&&F.caseReview===!0&&!J.current&&(T.some(e=>e.name===`用例质量评审提示词.md`)||(J.current=!0,ye(!0).then(()=>X()).catch(()=>void 0)))},[b,F.caseReview,T,X]),(0,w.useEffect)(()=>{b&&F.caseBlindspot===!0&&!Y.current&&(T.some(e=>e.name===`场景遗漏补全提示词.md`)||(Y.current=!0,ve(!0).then(()=>X()).catch(()=>void 0)))},[b,F.caseBlindspot,T,X]),(0,w.useEffect)(()=>{let e=s(e=>{f(!!e.prompts),I(e)});return n().then(()=>{f(a(`prompts`)),I(i()),r(!0)}),e},[]),(0,w.useEffect)(()=>{t&&l&&(async()=>{await ie(`prompts`)?(await ge().catch(()=>null),await X(),S(!0)):S(!1)})()},[t,l,X]);let Z=(0,w.useCallback)(async()=>{let e=await Te(),t=a(`reports`),n=a(`testReports`),r=t?await Se().catch(()=>null):null;Re(i=>{let a={};if(e)for(let t of e)a[g(t)]=`uiAuto`;else for(let[e,t]of Object.entries(i))t===`uiAuto`&&(a[e]=t);if(F.uiAuto&&(a[g(Ce)]=`uiAuto`),t){if(r?.promptFile)a[g(r.promptFile)]=`reports`;else for(let[e,t]of Object.entries(i))t===`reports`&&(a[e]=t)}if(n){let e=Ae();for(let t of je){let n=(e[t.id]??t.defaultPrompt).trim();n&&(a[g(n)]=`testReports`)}}if(F.reqAnalysis&&(a[g(se)]=`reqAnalysis`,a[g(le)]=`reqAnalysis`),F.storyReview&&(a[g(Oe)]=`storyReview`),F.testPoints&&(a[g(Ee)]=`testPoints`),F.caseReview&&(a[g(be)]=`caseReview`),F.caseBlindspot&&(a[g(xe)]=`caseBlindspot`),F.caseGen)for(let e of te()){let t=(e.promptPath??``).trim();t&&(a[g(t)]=`caseGen`)}return Ne(a),a})},[F.uiAuto,F.reqAnalysis,F.storyReview,F.testPoints,F.caseReview,F.caseBlindspot,F.caseGen]);(0,w.useEffect)(()=>{if(!t||!l)return;Z();let e=()=>{document.visibilityState===`visible`&&Z()};document.addEventListener(`visibilitychange`,e);let n=we(()=>void Z());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,l,F.uiAuto,F.reports,F.testReports,F.reqAnalysis,F.storyReview,F.testPoints,F.caseReview,F.caseBlindspot,F.caseGen,Z]);let Q=(0,w.useMemo)(()=>Object.keys(j).filter(e=>j[e]),[j]),$=(0,w.useCallback)(e=>{let t=_(e,L);return!t||t===`system`||de(e)?``:F[t]===!0?t:``},[L,F]);async function ze(e){A(!0),O(null);try{await ae(`prompts`,e.path)}catch(e){O(e instanceof Error?e.message:String(e))}finally{A(!1)}}async function Be(e){A(!0),O(null);try{await _e(`prompts`,e)}catch(e){O(e instanceof Error?e.message:String(e)),A(!1)}}function Ve(e){if(x(e.path)){O(`默认提示词不可删除`);return}if(v(e.path,F)){O(y(e.path,F));return}let t=$(e.path);if(t){let e=o(t)?.name??t;O(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else P({kind:`one`,entry:e})}function He(e){if(x(e.path)){O(`默认提示词不可改名`);return}if(v(e.path,F)){O(y(e.path,F));return}let t=$(e.path);if(t){let e=o(t)?.name??t;O(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else z(e),U(``)}function Ue(e){V(e),U(``)}async function We(){let e=N;if(e){P(null),A(!0),O(null);try{if(e.kind===`one`)await m(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)x(n)||v(n,F)||$(n)?t+=1:await m(`prompts`,n);t&&O(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),M({})}await X(),d(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);O(t),d(`删除失败:${t}`,`error`)}finally{A(!1)}}}function Ge(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:O(c(`promptGen`))}let Ke=(0,w.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=T.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[T]);async function qe(e){let t=R;if(!t)return;let n=e.trim();if(!n||n===t.name){z(null),U(``);return}let r=Ke(p(t.path),n,t.path);if(r)U(`已存在同名文件「${r}」,换个名字再试`);else{A(!0),U(``);try{await ne(`prompts`,t.path,n),z(null),await X(),d(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);U(t),d(`重命名失败:${t}`,`error`)}finally{A(!1)}}}async function Je(e){let t=B;if(!t)return;let n=e.trim();if(!n)return;let r=Ke(p(t.path),n);if(r)U(`已存在同名文件「${r}」,换个名字再试`);else{A(!0),U(``);try{let{content:e}=await re(`prompts`,t.path);await oe(`prompts`,p(t.path)===`.`?n:`${p(t.path)}/${n}`,e),V(null),await X(),d(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);U(t),d(`复制失败:${t}`,`error`)}finally{A(!1)}}}let Ye=N?.kind===`one`?`删除「${N.entry.name}」?将从 ${ue(`prompts`)} 中移除。`:N?.kind===`batch`?`确认删除已选中的 ${N.paths.length} 个提示词?此操作不可恢复。`:``;return t?l?b===null?(0,E.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,E.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,E.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):b?(0,E.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,E.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,E.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[W.query.trim()?(0,E.jsxs)(E.Fragment,{children:[`匹配 `,(0,E.jsx)(`span`,{className:`font-medium text-stone-800`,children:W.filtered.length}),` 个`,(0,E.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,T.length]})]}):(0,E.jsxs)(E.Fragment,{children:[`共 `,(0,E.jsx)(`span`,{className:`font-medium text-stone-800`,children:T.length}),` 个提示词`]}),Q.length>0?(0,E.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Q.length]}):null]}),(0,E.jsx)(`button`,{type:`button`,disabled:k||Q.length===0,onClick:()=>P({kind:`batch`,paths:Q}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,E.jsx)(`button`,{type:`button`,disabled:k,onClick:Ge,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成提示词`})]}),Le?(0,E.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:Le}):null,(0,E.jsx)(he,{resizeKey:`docs:prompts:cols:v1`,files:T,filtered:W.filtered,pageFiles:W.pageFiles,query:W.query,onQuery:W.setQuery,sortBy:W.sortBy,onSortBy:W.setSortBy,page:W.page,totalPages:W.totalPages,pageSize:W.pageSize,onPage:W.setPage,onPageSize:W.setPageSize,busy:k,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!h(e.path,F)&&!$(e.path),selected:j,onToggleRow:e=>M(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>M(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void ze(e),extraColumn:{header:`关联插件`,render:e=>(0,E.jsx)(Fe,{path:e.path,enabled:F,mounted:L})},renderNameAction:e=>(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{type:`button`,disabled:k,"aria-label":`重命名 ${e.name}`,onClick:()=>He(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,E.jsx)(u,{name:`pencil`,size:12})}),(0,E.jsx)(`button`,{type:`button`,disabled:k,"aria-label":`复制 ${e.name}`,onClick:()=>Ue(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,E.jsx)(u,{name:`copy`,size:12})})]}),renderActions:e=>{let t=h(e.path,F)||!!$(e.path);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{type:`button`,disabled:k,onClick:()=>void Be(e),className:`cursor-pointer whitespace-nowrap rounded bg-[#4176e6] px-2 py-1 text-xs text-white hover:bg-[#3565c7] disabled:opacity-40`,children:`在会话中打开`}),(0,E.jsx)(`button`,{type:`button`,disabled:k||t,"aria-label":`删除 ${e.name}`,onClick:()=>Ve(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,E.jsx)(u,{name:`trash`,size:12})})]})}}),(0,E.jsx)(C,{open:R!=null,title:`重命名提示词`,label:`文件名称`,initialValue:R?.name??``,lockExtension:!0,confirmLabel:`保存`,error:H,onClose:()=>{z(null),U(``)},onConfirm:e=>void qe(e)}),(0,E.jsx)(C,{open:B!=null,title:`复制提示词`,label:`新文件名称`,initialValue:B?B.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:H,onClose:()=>{V(null),U(``)},onConfirm:e=>void Je(e)}),(0,E.jsx)(ee,{open:N!=null,title:N?.kind===`batch`?`批量删除`:`删除提示词`,message:Ye,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>P(null),onConfirm:()=>void We()})]}):(0,E.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`提示词管理需要本地文档服务,当前未就绪。`}):(0,E.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:c(`prompts`)}):(0,E.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,E.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,E.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{Ie as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.DkyjuL-S.js";import{i,o as ee,s as te}from"./plugins.BRvXWHLe.js";import{t as a}from"./jsx-runtime.DUg_B_vD.js";import{t as ne}from"./ConfirmDialog.DrrPf1MB.js";import{n as re,t as o}from"./DocsPager.Duf4I68E.js";import{t as ie}from"./OverflowHint.CHZeFfUj.js";import{showToast as s}from"./Toast.BO2NFckG.js";import{v as ae}from"./project-docs.CCjtiFjB.js";import{a as oe,c,l as se,n as ce,o as le,s as ue,t as l}from"./report-prompt.B9C4cv84.js";import{t as de}from"./PromptMountDialog.mrTx3U5T.js";var u=e(t(),1),d=`tw.reports.kind.v1`,f=Object.keys(l);function p(e){return typeof e==`string`&&f.includes(e)}function fe(e=`day`){try{let t=localStorage.getItem(r(d));return p(t)?t:e}catch{return e}}function pe(e){if(p(e))try{localStorage.setItem(r(d),e)}catch{}}var m=a(),me=[`day`,`week`,`month`],he=20,ge=`tw.reports.page-size.v1`,_e=`# 工作汇报提示词
|
|
2
2
|
|
|
3
3
|
> 由「工作汇报」插件引用。日常增删改请只改本空间「提示词管理」里的本文件。
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DkyjuL-S.js";import{s as r}from"./plugins.BRvXWHLe.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./view-prefs.DhdLZjGh.js";import{i as d,n as f,r as p,t as m}from"./dialog.DZHZCe_T.js";import{t as h}from"./jsx-runtime.DUg_B_vD.js";import{t as g}from"./ConfirmDialog.DrrPf1MB.js";import{t as _}from"./OverflowHint.CHZeFfUj.js";import{t as v}from"./SelectDropdown.T3CKHaLt.js";import{A as ee,S as y,_ as b,g as te,m as x,u as S}from"./PmShared.BK8kWRSV.js";import{showToast as C}from"./Toast.BO2NFckG.js";import{o as w}from"./project-docs.CCjtiFjB.js";import{m as ne,p as re,u as ie}from"./settings.38J2uD5M.js";import{$ as ae,A as T,B as oe,C as se,D as ce,E as le,F as ue,G as de,H as fe,I as pe,J as me,K as he,L as ge,M as _e,N as ve,O as E,P as ye,Q as be,R as xe,S as Se,T as Ce,U as we,V as Te,W as Ee,X as De,Y as Oe,Z as ke,_ as Ae,a as je,at as Me,b as Ne,c as Pe,ct as D,d as Fe,et as Ie,f as Le,g as Re,h as ze,i as Be,it as Ve,j as He,k as Ue,l as We,m as Ge,n as O,nt as Ke,o as qe,ot as Je,p as Ye,q as Xe,r as k,s as Ze,st as Qe,t as $e,tt as et,u as tt,w as nt,x as rt,y as it}from"./req-analysis.B12_MGMQ.js";import{s as at}from"./llm.DN5S1KBK.js";import{t as ot}from"./MultiSelectDropdown.CBC7aNOv.js";import{_ as st,a as ct,c as lt,d as ut,f as dt,g as ft,h as pt,i as mt,l as ht,m as gt,n as _t,o as vt,p as yt,r as bt,s as xt,u as St,y as Ct}from"./story-review.D2W5tEOY.js";import{t as wt}from"./hydrate-cache.B15Nrpq0.js";var A=e(t(),1),Tt=`可用工具(只调用这些,不要自己编工具名):
|
|
2
2
|
- req_set_outline:在已播种的文档条目下提交查询/修改子点(带 parentId、kind),返回 id 供 sourceRefs 引用。不要另造文档里没有的条目标题。同一 parentId 下按能力点拆多条子点(可多个 query、多个 mutate),勿把多个能力点合并成一条。
|
|
3
3
|
- req_insert_outline_after:在指定已有子点下方插入新的查询/修改子点(用户补充需求内容时用);afterId 固定为消息里给出的锚点;插入后同父级子点 id 按序号顺延。
|
|
4
4
|
- req_update_outline_point:按 id 更新已有查询/修改子点的标题 / 类型 / 原文(id 不变);用户变更当前点内容时用。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DwpFFa5D.js";import{i as r,o as i,s as a}from"./plugins.BmKRnp4a.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.D5qXeML0.js";import{n as c,t as ee}from"./DocsPager.ceBEecmd.js";import{showToast as l}from"./Toast.BO2NFckG.js";import{a as te,c as u,d as ne,g as re,h as ie,i as ae,l as oe,m as se,n as ce,p as le,r as ue,s as d,t as de,u as fe}from"./project-docs.CCjtiFjB.js";import{n as pe}from"./doc-roots.CO3IBiY6.js";import{t as f}from"./NamePromptDialog.Csfnh5eM.js";import{n as me,t as he}from"./docs-format.BlGh-XA_.js";import{t as ge}from"./useListAnim.BoerpmsB.js";var p=e(t(),1),m=o(),_e=5;function h({className:e=`w-4 h-4`,open:t=!1}){return(0,m.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,m.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}):(0,m.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function g({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z`}),(0,m.jsx)(`path`,{d:`m15 5 4 4`})]})}function _({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M3 6h18`}),(0,m.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,m.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,m.jsx)(`path`,{d:`M10 11v6`}),(0,m.jsx)(`path`,{d:`M14 11v6`})]})}function v({node:e,depth:t,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o}){let s=r[e.path]??i,c=n===e.path;return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.path),e.children.length&&a(e.path)},"aria-expanded":e.children.length?s:void 0,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${c?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(h,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:e.children.map(e=>(0,m.jsx)(v,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function y(){let[e,t]=(0,p.useState)(()=>r(`requirements`)),[o,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),[S,ve]=(0,p.useState)([]),[ye,be]=(0,p.useState)(0),[C,w]=(0,p.useState)(`.`),[T,E]=(0,p.useState)([]),[xe,D]=(0,p.useState)({}),[O,Se]=(0,p.useState)(!0),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[Ce,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),[R,z]=(0,p.useState)(null),[we,B]=(0,p.useState)(1),[V,Te]=c(_e),[Ee,H]=(0,p.useState)(null),U=(0,p.useRef)(null),{cls:De,play:W}=ge(),G=(0,p.useCallback)(async()=>{let e=await ae(`requirements`);ve(e.tree),be(e.totalFiles)},[]),K=(0,p.useCallback)(async(e=C)=>{A(null);try{let[t]=await Promise.all([u(`requirements`,e),G()]);E(t.entries),w(t.path)}catch(e){A(e instanceof Error?e.message:String(e))}},[C,G]);(0,p.useEffect)(()=>{let e=i(e=>t(!!e.requirements));return n().then(()=>{t(r(`requirements`)),y(!0)}),e},[]),(0,p.useEffect)(()=>{o&&e&&(async()=>{if(!await ue(`requirements`))x(!1);else try{let[e]=await Promise.all([u(`requirements`,`.`),G()]);E(e.entries),w(e.path),x(!0)}catch(e){A(e instanceof Error?e.message:String(e)),x(!0)}})()},[o,e,G]);function Oe(){Se(e=>!e),D({})}async function q(e){W(),w(e),B(1),P(null),H(null),A(null);try{let t=await u(`requirements`,e);E(t.entries)}catch(e){A(e instanceof Error?e.message:String(e))}}async function ke(e){F(!1),M(!0),A(null);try{await oe(`requirements`,C,e),await K(C),l(`已新建文件夹「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`新建文件夹失败:${t}`,`error`)}finally{M(!1)}}async function Ae(e){if(e.type===`file`){M(!0),A(null);try{await fe(`requirements`,e.path)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function je(e){if(e?.length){M(!0),A(null);try{for(let t of Array.from(e))await re(`requirements`,C,t);await K(C),l(`已上传 ${e.length} 个文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`上传失败:${t}`,`error`)}finally{M(!1),U.current&&(U.current.value=``)}}}function Me(e){let t=te(S,e.path),n=t?.fileCount??0,r=t?de(t):0;L({...e,isDir:!0,blocked:n>0||r>0,files:n,dirs:r})}function J(e){L({name:e.name,path:e.path,isDir:!1})}function Y(e,t){z({...e,isDir:t})}async function Ne(){let e=I;if(e&&(L(null),!e.blocked)){M(!0),A(null);try{await ce(`requirements`,e.path),N&&d(N.path,e.path)&&P(null);let t=d(C,e.path)?ne(e.path):C;await K(t),l(`已删除「${e.name}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`删除失败:${t}`,`error`)}finally{M(!1)}}}async function Pe(e){let t=R;if(t&&(z(null),e!==t.name)){M(!0),A(null);try{let n=await ie(`requirements`,t.path,e);await K(se(C,t.path,n)),l(`已重命名为「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`重命名失败:${t}`,`error`)}finally{M(!1)}}}let Fe=(()=>{if(!I)return``;if(!I.isDir)return`删除文件「${I.name}」?将移入系统废纸篓,可随时找回。`;if(I.blocked){let e=[];return I.files&&e.push(`${I.files} 个文件`),I.dirs&&e.push(`${I.dirs} 个子文件夹`),`文件夹「${I.name}」中还有 ${e.join(`、`)},请先清空内部内容后再删除。`}return`删除文件夹「${I.name}」?将移入系统废纸篓。`})();async function Ie(e){if(e.type!==`file`)return;let t=e.name.toLowerCase();if(t.endsWith(`.md`)||t.endsWith(`.txt`)){M(!0),A(null);try{let t=await le(`requirements`,e.path);P({path:t.path,content:t.content})}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}if(!o)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`requirements`)});if(b===null)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!b)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`需求文档库需要本地文档服务,当前未就绪。`});let X=T.filter(e=>e.type===`file`).slice().sort((e,t)=>(t.ctime??t.mtime??0)-(e.ctime??e.mtime??0)),Z=T.filter(e=>e.type===`dir`),Q=Math.max(1,Math.ceil(X.length/V)),$=Math.min(we,Q),Le=X.slice(($-1)*V,$*V);function Re(e){W(),Te(e),B(1)}return(0,m.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,m.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>F(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1 space-y-1`,children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${C===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{q(`.`),Oe()},"aria-expanded":O,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${C===`.`?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(h,{open:O,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部需求`}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,ye,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${O?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:S.map(e=>(0,m.jsx)(v,{node:e,depth:0,activePath:C,expanded:xe,globalOpen:O,onToggle:e=>D(t=>({...t,[e]:!(t[e]??O)})),onSelect:e=>void q(e)},e.path))})})]})]}),(0,m.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,m.jsx)(`span`,{className:`text-stone-400`,children:pe(`requirements`)}),C===`.`?``:C]}),(0,m.jsx)(`input`,{ref:U,type:`file`,multiple:!0,accept:`.md,.txt,.docx,.xlsx,.xls,.csv,text/plain,text/markdown,text/csv,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel`,className:`hidden`,onChange:e=>void je(e.target.files)}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>U.current?.click(),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`上传文件`})]}),k?(0,m.jsx)(`div`,{className:`mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:k}):null,(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,m.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void q(e.path),children:[(0,m.jsx)(h,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!0),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>Me({name:e.name,path:e.path}),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,m.jsx)(`p`,{className:`text-sm text-stone-400 py-6 text-center border border-dashed border-stone-200 rounded-lg`,children:`当前文件夹为空,点击「上传文件」添加需求文档(.md / .txt / .docx / .xlsx / .csv)`}):(0,m.jsx)(`ul`,{className:`${De}space-y-1`,children:Le.map(e=>{let t=Ee===e.path;return(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${t?`border-[#c7dcff] bg-[#e8f0fe]`:`border-stone-100 hover:bg-stone-50`}`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,onClick:()=>{H(e.path),Ie(e)},onDoubleClick:t=>{t.preventDefault(),Ae(e)},children:[(0,m.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`div`,{className:`text-[11px] text-stone-400`,children:[he(e.size),e.ctime||e.mtime?` · ${me(e.ctime??e.mtime)}`:``]})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!1),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>J(e),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path)})})]}),N?(0,m.jsxs)(`div`,{className:`rounded-lg border border-stone-200 overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2 bg-stone-50 border-b border-stone-200 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs text-stone-500 truncate`,children:N.path}),(0,m.jsx)(`button`,{type:`button`,className:`text-xs text-stone-500 hover:text-stone-800`,onClick:()=>P(null),children:`关闭预览`})]}),(0,m.jsx)(`pre`,{className:`max-h-80 overflow-auto p-4 text-xs leading-5 text-stone-700 whitespace-pre-wrap bg-white`,children:N.content})]}):null]}),X.length>0?(0,m.jsx)(ee,{page:$,totalPages:Q,pageSize:V,busy:j,onPage:e=>{W(),B(e)},onPageSize:Re}):null]}),(0,m.jsx)(f,{open:Ce,title:`新建文件夹`,onClose:()=>F(!1),onConfirm:e=>void ke(e)}),(0,m.jsx)(f,{open:R!=null,title:R?.isDir?`重命名文件夹`:`重命名文件`,label:R?.isDir?`文件夹名称`:`文件名称`,initialValue:R?.name??``,lockExtension:R!=null&&!R.isDir,confirmLabel:`保存`,onClose:()=>z(null),onConfirm:e=>void Pe(e)}),(0,m.jsx)(s,{open:I!=null,title:I?.blocked?`无法删除文件夹`:I?.isDir?`删除文件夹`:`删除需求文件`,message:Fe,confirmLabel:I?.blocked?`知道了`:`删除`,cancelLabel:`取消`,danger:!I?.blocked,hideCancel:!!I?.blocked,onClose:()=>L(null),onConfirm:()=>void Ne()})]})}export{y as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DkyjuL-S.js";import{i as r,o as i,s as a}from"./plugins.BRvXWHLe.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.DrrPf1MB.js";import{n as c,t as ee}from"./DocsPager.Duf4I68E.js";import{showToast as l}from"./Toast.BO2NFckG.js";import{a as te,c as u,d as ne,g as re,h as ie,i as ae,l as oe,m as se,n as ce,p as le,r as ue,s as d,t as de,u as fe}from"./project-docs.CCjtiFjB.js";import{n as pe}from"./doc-roots.CO3IBiY6.js";import{t as f}from"./NamePromptDialog.Csfnh5eM.js";import{n as me,t as he}from"./docs-format.BlGh-XA_.js";import{t as ge}from"./useListAnim.BoerpmsB.js";var p=e(t(),1),m=o(),_e=5;function h({className:e=`w-4 h-4`,open:t=!1}){return(0,m.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,m.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}):(0,m.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function g({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z`}),(0,m.jsx)(`path`,{d:`m15 5 4 4`})]})}function _({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M3 6h18`}),(0,m.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,m.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,m.jsx)(`path`,{d:`M10 11v6`}),(0,m.jsx)(`path`,{d:`M14 11v6`})]})}function v({node:e,depth:t,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o}){let s=r[e.path]??i,c=n===e.path;return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.path),e.children.length&&a(e.path)},"aria-expanded":e.children.length?s:void 0,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${c?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(h,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:e.children.map(e=>(0,m.jsx)(v,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function y(){let[e,t]=(0,p.useState)(()=>r(`requirements`)),[o,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),[S,ve]=(0,p.useState)([]),[ye,be]=(0,p.useState)(0),[C,w]=(0,p.useState)(`.`),[T,E]=(0,p.useState)([]),[xe,D]=(0,p.useState)({}),[O,Se]=(0,p.useState)(!0),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[Ce,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),[R,z]=(0,p.useState)(null),[we,B]=(0,p.useState)(1),[V,Te]=c(_e),[Ee,H]=(0,p.useState)(null),U=(0,p.useRef)(null),{cls:De,play:W}=ge(),G=(0,p.useCallback)(async()=>{let e=await ae(`requirements`);ve(e.tree),be(e.totalFiles)},[]),K=(0,p.useCallback)(async(e=C)=>{A(null);try{let[t]=await Promise.all([u(`requirements`,e),G()]);E(t.entries),w(t.path)}catch(e){A(e instanceof Error?e.message:String(e))}},[C,G]);(0,p.useEffect)(()=>{let e=i(e=>t(!!e.requirements));return n().then(()=>{t(r(`requirements`)),y(!0)}),e},[]),(0,p.useEffect)(()=>{o&&e&&(async()=>{if(!await ue(`requirements`))x(!1);else try{let[e]=await Promise.all([u(`requirements`,`.`),G()]);E(e.entries),w(e.path),x(!0)}catch(e){A(e instanceof Error?e.message:String(e)),x(!0)}})()},[o,e,G]);function Oe(){Se(e=>!e),D({})}async function q(e){W(),w(e),B(1),P(null),H(null),A(null);try{let t=await u(`requirements`,e);E(t.entries)}catch(e){A(e instanceof Error?e.message:String(e))}}async function ke(e){F(!1),M(!0),A(null);try{await oe(`requirements`,C,e),await K(C),l(`已新建文件夹「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`新建文件夹失败:${t}`,`error`)}finally{M(!1)}}async function Ae(e){if(e.type===`file`){M(!0),A(null);try{await fe(`requirements`,e.path)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function je(e){if(e?.length){M(!0),A(null);try{for(let t of Array.from(e))await re(`requirements`,C,t);await K(C),l(`已上传 ${e.length} 个文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`上传失败:${t}`,`error`)}finally{M(!1),U.current&&(U.current.value=``)}}}function Me(e){let t=te(S,e.path),n=t?.fileCount??0,r=t?de(t):0;L({...e,isDir:!0,blocked:n>0||r>0,files:n,dirs:r})}function J(e){L({name:e.name,path:e.path,isDir:!1})}function Y(e,t){z({...e,isDir:t})}async function Ne(){let e=I;if(e&&(L(null),!e.blocked)){M(!0),A(null);try{await ce(`requirements`,e.path),N&&d(N.path,e.path)&&P(null);let t=d(C,e.path)?ne(e.path):C;await K(t),l(`已删除「${e.name}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`删除失败:${t}`,`error`)}finally{M(!1)}}}async function Pe(e){let t=R;if(t&&(z(null),e!==t.name)){M(!0),A(null);try{let n=await ie(`requirements`,t.path,e);await K(se(C,t.path,n)),l(`已重命名为「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`重命名失败:${t}`,`error`)}finally{M(!1)}}}let Fe=(()=>{if(!I)return``;if(!I.isDir)return`删除文件「${I.name}」?将移入系统废纸篓,可随时找回。`;if(I.blocked){let e=[];return I.files&&e.push(`${I.files} 个文件`),I.dirs&&e.push(`${I.dirs} 个子文件夹`),`文件夹「${I.name}」中还有 ${e.join(`、`)},请先清空内部内容后再删除。`}return`删除文件夹「${I.name}」?将移入系统废纸篓。`})();async function Ie(e){if(e.type!==`file`)return;let t=e.name.toLowerCase();if(t.endsWith(`.md`)||t.endsWith(`.txt`)){M(!0),A(null);try{let t=await le(`requirements`,e.path);P({path:t.path,content:t.content})}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}if(!o)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`requirements`)});if(b===null)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!b)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`需求文档库需要本地文档服务,当前未就绪。`});let X=T.filter(e=>e.type===`file`).slice().sort((e,t)=>(t.ctime??t.mtime??0)-(e.ctime??e.mtime??0)),Z=T.filter(e=>e.type===`dir`),Q=Math.max(1,Math.ceil(X.length/V)),$=Math.min(we,Q),Le=X.slice(($-1)*V,$*V);function Re(e){W(),Te(e),B(1)}return(0,m.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,m.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>F(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1 space-y-1`,children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${C===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{q(`.`),Oe()},"aria-expanded":O,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${C===`.`?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(h,{open:O,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部需求`}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,ye,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${O?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:S.map(e=>(0,m.jsx)(v,{node:e,depth:0,activePath:C,expanded:xe,globalOpen:O,onToggle:e=>D(t=>({...t,[e]:!(t[e]??O)})),onSelect:e=>void q(e)},e.path))})})]})]}),(0,m.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,m.jsx)(`span`,{className:`text-stone-400`,children:pe(`requirements`)}),C===`.`?``:C]}),(0,m.jsx)(`input`,{ref:U,type:`file`,multiple:!0,accept:`.md,.txt,.docx,.xlsx,.xls,.csv,text/plain,text/markdown,text/csv,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel`,className:`hidden`,onChange:e=>void je(e.target.files)}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>U.current?.click(),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`上传文件`})]}),k?(0,m.jsx)(`div`,{className:`mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:k}):null,(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,m.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void q(e.path),children:[(0,m.jsx)(h,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!0),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>Me({name:e.name,path:e.path}),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,m.jsx)(`p`,{className:`text-sm text-stone-400 py-6 text-center border border-dashed border-stone-200 rounded-lg`,children:`当前文件夹为空,点击「上传文件」添加需求文档(.md / .txt / .docx / .xlsx / .csv)`}):(0,m.jsx)(`ul`,{className:`${De}space-y-1`,children:Le.map(e=>{let t=Ee===e.path;return(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${t?`border-[#c7dcff] bg-[#e8f0fe]`:`border-stone-100 hover:bg-stone-50`}`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,onClick:()=>{H(e.path),Ie(e)},onDoubleClick:t=>{t.preventDefault(),Ae(e)},children:[(0,m.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`div`,{className:`text-[11px] text-stone-400`,children:[he(e.size),e.ctime||e.mtime?` · ${me(e.ctime??e.mtime)}`:``]})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!1),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>J(e),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path)})})]}),N?(0,m.jsxs)(`div`,{className:`rounded-lg border border-stone-200 overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2 bg-stone-50 border-b border-stone-200 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs text-stone-500 truncate`,children:N.path}),(0,m.jsx)(`button`,{type:`button`,className:`text-xs text-stone-500 hover:text-stone-800`,onClick:()=>P(null),children:`关闭预览`})]}),(0,m.jsx)(`pre`,{className:`max-h-80 overflow-auto p-4 text-xs leading-5 text-stone-700 whitespace-pre-wrap bg-white`,children:N.content})]}):null]}),X.length>0?(0,m.jsx)(ee,{page:$,totalPages:Q,pageSize:V,busy:j,onPage:e=>{W(),B(e)},onPageSize:Re}):null]}),(0,m.jsx)(f,{open:Ce,title:`新建文件夹`,onClose:()=>F(!1),onConfirm:e=>void ke(e)}),(0,m.jsx)(f,{open:R!=null,title:R?.isDir?`重命名文件夹`:`重命名文件`,label:R?.isDir?`文件夹名称`:`文件名称`,initialValue:R?.name??``,lockExtension:R!=null&&!R.isDir,confirmLabel:`保存`,onClose:()=>z(null),onConfirm:e=>void Pe(e)}),(0,m.jsx)(s,{open:I!=null,title:I?.blocked?`无法删除文件夹`:I?.isDir?`删除文件夹`:`删除需求文件`,message:Fe,confirmLabel:I?.blocked?`知道了`:`删除`,cancelLabel:`取消`,danger:!I?.blocked,hideCancel:!!I?.blocked,onClose:()=>L(null),onConfirm:()=>void Ne()})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./jsx-runtime.DUg_B_vD.js";import{t as r}from"./OverflowHint.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./jsx-runtime.DUg_B_vD.js";import{t as r}from"./OverflowHint.CHZeFfUj.js";import{t as i}from"./SelectDropdown.T3CKHaLt.js";var a=e(t(),1),o=n();function s({options:e,value:t,onChange:n,placeholder:s=`搜索并选择…`,disabled:c=!1,allowEmpty:l=!0,emptyLabel:u=`不选择`}){let d=(0,a.useMemo)(()=>{let t=e.map(e=>({value:e.value,label:e.label}));return l?[{value:``,label:u,muted:!0},...t]:t},[e,l,u]),f=t?d.find(e=>e.value===t):void 0;return(0,o.jsx)(i,{options:d,value:t,onChange:n,disabled:c,searchable:!0,searchPlaceholder:s,dimWhenOpen:!0,renderTrigger:(e,{open:t})=>f?(0,o.jsx)(`span`,{className:`min-w-0 truncate ${t?`text-stone-400`:``}`,children:(0,o.jsx)(r,{text:f.label,className:`block truncate`})}):(0,o.jsx)(`span`,{className:`min-w-0 truncate text-stone-400`,children:s})})}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./listbox.DNxAJmEo.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./OverflowHint.CHZeFfUj.js";var c=e(t(),1),l=o(),u=210;function d({value:e,onChange:t,placeholder:n,ariaLabel:r,onEnterCreate:i}){let a=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=a.current;if(!e)return;e.focus();let t=requestAnimationFrame(()=>e.focus());return()=>cancelAnimationFrame(t)},[]),(0,l.jsx)(`div`,{className:`shrink-0 border-b border-stone-100 bg-white px-1.5 py-1.5`,children:(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsxs)(`svg`,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,l.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,l.jsx)(`path`,{d:`m16.5 16.5 4 4`})]}),(0,l.jsx)(`input`,{ref:a,value:e,onChange:e=>t(e.target.value),onKeyDown:t=>{if(t.key===`Enter`&&i){let n=e.trim();if(n){t.preventDefault(),t.stopPropagation(),i(n);return}}[`Escape`,`Enter`,`ArrowDown`,`ArrowUp`].includes(t.key)||t.stopPropagation()},placeholder:n,"aria-label":r,spellCheck:!1,className:`h-8 w-full rounded-md border border-stone-200 bg-stone-50 pl-7 pr-2 text-sm text-stone-700 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]})})}function f(){return(0,l.jsx)(`svg`,{className:`w-4 h-4 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":!0,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,d:`M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z`,clipRule:`evenodd`})})}function p({options:e,value:t,onChange:o,disabled:p=!1,className:m=``,compact:h=!1,ariaLabel:g,showCheck:_=!1,centerContent:v=!1,unstyled:y=!1,fitContent:b=!1,triggerClassName:x=``,hideChevron:S=!0,flat:C=!1,menuMinWidth:w,menuMatchTrigger:T=!0,renderTrigger:E,renderOptionPrefix:D,renderOptionAction:O,searchable:k=!1,searchPlaceholder:A=`搜索…`,onSearchCreate:j,triggerTitle:M,hideTriggerHint:N=!1,dimWhenOpen:P=!1}){let F=e.find(e=>e.value===t),[I,L]=(0,c.useState)(``),R=(0,c.useMemo)(()=>{let t=I.trim().toLowerCase();return t?e.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):e},[e,I]),z=(0,c.useMemo)(()=>{if(!j)return``;let t=I.trim();return!t||e.some(e=>e.label===t)?``:t},[j,e,I]),B=v?`justify-center`:`justify-start`,V=y?b?`inline-flex !w-auto max-w-full min-w-0 items-center overflow-hidden cursor-pointer outline-none disabled:cursor-not-allowed`:`flex w-full min-w-0 items-center overflow-hidden cursor-pointer outline-none disabled:cursor-not-allowed`:h?`tw-field-trigger w-full min-w-0 h-8 flex items-center gap-1.5 overflow-hidden rounded-lg border border-stone-300 bg-white px-2.5 text-sm text-left text-stone-700 outline-none cursor-pointer hover:border-stone-400 focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] disabled:bg-stone-50 disabled:text-stone-400 disabled:cursor-not-allowed`:C?`tw-field-trigger w-full min-w-0 h-9 flex items-center gap-2 overflow-hidden rounded-lg border border-stone-200 bg-white px-2.5 text-sm text-left text-stone-700 outline-none cursor-pointer hover:border-stone-300 focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] disabled:bg-stone-50 disabled:text-stone-400 disabled:cursor-not-allowed`:`tw-field-trigger w-full min-w-0 h-9 flex items-center gap-2 overflow-hidden rounded-lg border border-stone-200 bg-white px-3 text-sm text-left text-stone-800 outline-none cursor-pointer hover:border-stone-300 focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] disabled:bg-stone-50 disabled:text-stone-400 disabled:cursor-not-allowed`;return(0,l.jsx)(i,{value:t,onChange:e=>{L(``),o(e)},disabled:p,children:({open:i})=>(0,l.jsxs)(`div`,{className:`relative ${y?b?`inline-block max-w-full min-w-0 align-middle`:`block w-full min-w-0`:h?`inline-block`:C?``:`mt-1`} ${m}`,children:[(0,l.jsx)(n,{"aria-label":g,onClick:()=>{k&&L(``)},className:`${V} ${B} ${x} ${P&&i?`text-stone-400`:``}`,children:E?E(F,{open:i}):(0,l.jsx)(s,{text:M??F?.label??t,className:`block min-w-0 flex-1 basis-0 truncate`,disabled:N})}),(0,l.jsxs)(a,{transition:!0,anchor:{to:`bottom start`,gap:4,padding:12},style:T?{width:`max(12rem, var(--button-width, 12rem))`,minWidth:`max(12rem, var(--button-width, 12rem))`}:{width:`min(280px, max(12rem, var(--button-width, 12rem)))`,maxWidth:280,minWidth:w||150},className:`tw-select-menu tw-menu-anim z-[200] flex max-h-64 min-w-0 flex-col overflow-hidden rounded-lg shadow-lg ring-1 ring-stone-200 [--anchor-max-height:16rem] focus:outline-none ${T?`w-[max(12rem,var(--button-width,12rem))]`:`w-[min(280px,max(12rem,var(--button-width,12rem)))] max-w-[280px]`}`,children:[k?(0,l.jsx)(d,{value:I,onChange:L,placeholder:A,ariaLabel:g?`${g}搜索`:`搜索选项`,onEnterCreate:j?async t=>{let n=e.find(e=>e.label===t);return n?(L(``),o(n.value),!0):(await j(t),L(``),!0)}:void 0}):null,(0,l.jsxs)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 space-y-1 overflow-x-hidden overflow-y-auto p-1 pb-2`,children:[z?(0,l.jsx)(`div`,{className:`min-w-0 px-3 py-1.5 text-xs text-stone-400`,children:(0,l.jsx)(s,{text:`回车新增「${z}」`,className:`block w-full truncate`})}):null,k&&R.length===0&&!z?(0,l.jsx)(`div`,{className:`px-3 py-2 text-sm text-stone-400`,children:`无匹配项`}):null,R.map(e=>(0,l.jsxs)(r,{value:e.value,disabled:e.disabled,className:`group flex w-full min-w-0 max-w-full select-none items-center gap-2 overflow-hidden rounded-md px-3 py-2 text-sm leading-5 data-[focus]:bg-stone-50 data-[selected]:bg-(--tw-accent-soft) ${e.disabled?`cursor-not-allowed text-stone-300 data-[focus]:bg-transparent data-[selected]:bg-transparent data-[selected]:font-normal`:`cursor-pointer`} ${_?`text-stone-700 data-[selected]:text-stone-900`:`data-[selected]:text-(--tw-accent) data-[selected]:font-medium`} ${e.muted?`text-stone-400 data-[selected]:text-stone-500`:``} ${v&&!_&&!D?`justify-center px-2`:``}`,children:[_?(0,l.jsx)(`span`,{className:`w-4 shrink-0 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100`,children:(0,l.jsx)(f,{})}):D?(0,l.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:D(e)}):null,(0,l.jsxs)(`span`,{className:`min-w-0 flex-1 basis-0 overflow-hidden`,children:[(0,l.jsx)(s,{text:e.label,className:`block w-full truncate`,zIndex:u}),e.secondary?(0,l.jsx)(s,{text:e.secondary,className:`mt-0.5 block w-full truncate font-mono text-[10px] font-normal leading-4 text-stone-400`,zIndex:u}):null]}),O?(0,l.jsx)(`span`,{className:`ml-0.5 flex shrink-0 items-center`,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),e.preventDefault()},children:O(e)}):null]},e.value))]})]})]})})}export{p as t};
|