nx-kv 0.68.0 → 0.68.2
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 +60 -0
- package/package.json +1 -1
- package/src/core/db/seed-templates.ts +10 -50
- package/src/web/frontend/App.tsx +12 -0
- package/src/web/frontend/components/layout/vsc-crumbs.css +16 -9
- package/src/web/frontend/components/layout/vsc-crumbs.tsx +47 -25
- package/src/web/frontend/components/popup/index.tsx +4 -1
- package/src/web/frontend/components/popup/style.css +2 -0
- package/src/web/frontend/components/sidebar/index.tsx +4 -2
- package/src/web/frontend/components/sidebar/ns-dialogs.tsx +9 -2
- package/src/web/frontend/components/sidebar/ns-manage-modal.tsx +80 -23
- package/src/web/frontend/components/sidebar/use-ns.ts +11 -1
- package/src/web/frontend/components/task-panel/task-page.tsx +1 -0
- package/src/web/frontend/components/task-panel/task-row.tsx +50 -21
- package/src/web/frontend/modules/md/fill-session.ts +36 -0
- package/src/web/frontend/modules/md/new-task-from-template.ts +22 -0
- package/src/web/frontend/modules/md/task-intent.ts +29 -0
- package/src/web/frontend/modules/prompts/render-template-body.ts +14 -0
- package/src/web/frontend/modules/prompts/template-preview.ts +62 -0
- package/src/web/frontend/page/dir/index.tsx +13 -3
- package/src/web/frontend/page/dir/task-beside.ts +64 -0
- package/src/web/frontend/page/dir/task.tsx +12 -24
- package/src/web/frontend/page/dir/use-auto-submit.ts +20 -0
- package/src/web/frontend/page/group/index.tsx +19 -3
- package/src/web/frontend/page/templates/fill.tsx +128 -0
- package/src/web/frontend/page/templates/index.tsx +6 -0
- package/src/web/frontend/page/templates/manage.tsx +7 -33
- package/src/web/frontend/page/templates/style.css +32 -5
- package/src/web/frontend/page/templates/template-list.tsx +48 -68
- package/src/web/frontend/routes/templates.ts +10 -0
- package/src/web/frontend/styles-v2/dag.css +22 -1
- package/src/web/frontend/styles-v2/sidebar.css +15 -0
- package/src/web/public/assets/app-context-KCsdqNTq.js +1 -0
- package/src/web/public/assets/{bar-C-XvccT_.js → bar-DEY9q8mI.js} +1 -1
- package/src/web/public/assets/{button-Cs6w2CDi.js → button-BRGGaUcY.js} +1 -1
- package/src/web/public/assets/{composer-launch-DocQvHKh.js → composer-launch-DEHhs8k_.js} +1 -1
- package/src/web/public/assets/{composer-panel-BYxKIE03.js → composer-panel-Btmv_9MI.js} +1 -1
- package/src/web/public/assets/{dag-EGY58BeS.js → dag-CD7N_yfu.js} +1 -1
- package/src/web/public/assets/dir-B0nwSQhy.js +1 -0
- package/src/web/public/assets/{doc-CKbuO1Gj.js → doc-R8KHVCxp.js} +1 -1
- package/src/web/public/assets/group-B-f_aoow.js +1 -0
- package/src/web/public/assets/index-Bs5BehN8.js +3 -0
- package/src/web/public/assets/{index-BruTRXSA.css → index-GyxCJY9y.css} +1 -1
- package/src/web/public/assets/manage-session-CuaL7QqQ.js +1 -0
- package/src/web/public/assets/{md-history-sxG54jJ_.js → md-history-BR2jLhFQ.js} +1 -1
- package/src/web/public/assets/{member-picker-CHX0nS0O.js → member-picker-BJ-Ucm-9.js} +1 -1
- package/src/web/public/assets/{popup-dBtYqEM1.js → popup-BdVXUaJk.js} +1 -1
- package/src/web/public/assets/{popup-BAvk7J7u.css → popup-CHK8uSG4.css} +1 -1
- package/src/web/public/assets/{progress-CPQSMxLp.js → progress-CLSIX544.js} +1 -1
- package/src/web/public/assets/{refs-Bzf1kVpx.js → refs-Cb9pmVsb.js} +1 -1
- package/src/web/public/assets/{reopen-text-B2d9SZi0.js → reopen-text-C3dnqygC.js} +1 -1
- package/src/web/public/assets/{repo-form-modal-geOSTx9x.js → repo-form-modal-awEPCcJK.js} +1 -1
- package/src/web/public/assets/{repos-BbKWW4no.js → repos-CIgKjolu.js} +1 -1
- package/src/web/public/assets/{route-crumb-CqDySF_k.js → route-crumb-DvXzznKm.js} +1 -1
- package/src/web/public/assets/{settings-iqLRF9ip.js → settings-BD9rXOpy.js} +1 -1
- package/src/web/public/assets/task-CJyFbImw.js +14 -0
- package/src/web/public/assets/task-intent-CX5DZccN.js +1 -0
- package/src/web/public/assets/{task-Dcd2eA8B.css → task-j7fMfJUp.css} +1 -1
- package/src/web/public/assets/task-ops-CsiArYZB.js +2 -0
- package/src/web/public/assets/template-preview-CjQ-ucPt.js +1 -0
- package/src/web/public/assets/templates-BC-bPIfY.js +10 -0
- package/src/web/public/assets/templates-DiEKBY-m.css +1 -0
- package/src/web/public/assets/{tool-bar-DpfJRjFG.js → tool-bar-CAMqYt5j.js} +1 -1
- package/src/web/public/assets/{use-rail-drag-DcUzHeV_.js → use-rail-drag-C3GpkThI.js} +1 -1
- package/src/web/public/index.html +12 -12
- package/src/web/frontend/page/templates/scope-chips.tsx +0 -237
- package/src/web/public/assets/app-context-CngKv8Tc.js +0 -1
- package/src/web/public/assets/dir-BjMCzD3e.js +0 -1
- package/src/web/public/assets/group-Bh5tkQR3.js +0 -1
- package/src/web/public/assets/index-cyRcywoY.js +0 -3
- package/src/web/public/assets/manage-session-CS8UvmUd.js +0 -1
- package/src/web/public/assets/task-BeaiJyO3.js +0 -14
- package/src/web/public/assets/task-ops-BKVm1WHw.js +0 -2
- package/src/web/public/assets/templates-B32TlcGk.js +0 -10
- package/src/web/public/assets/templates-CwYDIBYn.css +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
本文件对外可见的变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。
|
|
4
4
|
|
|
5
|
+
## [0.68.2] - 2026-11-24 面包屑二轮验收:下拉定宽滚动 + 任务段双按钮
|
|
6
|
+
|
|
7
|
+
#254 的验收反馈(#259):「点击出现的面板固定最大高度,超过在容器内滚动;宽度调到
|
|
8
|
+
150px;任务的面板 hover 显示两个 icon btn——复制 + 预览,点击出现子侧边栏显示对应
|
|
9
|
+
任务原文」。
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- 任务段 hover 出**两个** icon btn:复制(沿「路径复制偏好」两态不变)+ 预览
|
|
14
|
+
(眼睛,`onPreview` 由任务页提供:评论任务跳来源原文,普通任务把自己的原文
|
|
15
|
+
旁路打开——`openBesideMain` 先收旧旁路,同一时刻只有一块;草稿 toast 提示)。
|
|
16
|
+
旁路原文「子侧边栏」即 PagePanel 的 beside 形态(BesideHeader 关闭条),非新组件。
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `.pp-menu` 加全局固定最大高度 `min(60vh, 440px)` + 容器内滚动——所有 PopMenu
|
|
21
|
+
的同级清单超长不再顶出视口。
|
|
22
|
+
- `PopMenu` 新增可选 `width`(内联同时压 `width + minWidth`,否则盖不过 CSS 的
|
|
23
|
+
`min-width:168px`);面包屑三段下拉统一定宽 **150px**,缺省行为不变。
|
|
24
|
+
- 任务页 beside 三函数(打开来源原文 / 关闭自己 / 预览原文)抽成 `task-beside.ts`
|
|
25
|
+
的 `useBesideOps`——task.tsx 回到 600 行门禁内。
|
|
26
|
+
|
|
27
|
+
### Verification
|
|
28
|
+
|
|
29
|
+
- 全量门禁通过:lint / typecheck / build / smoke / unit 1179/1179。
|
|
30
|
+
- Playwright 探针实测(独立 store + 压矮视口触发滚动,8 项断言全绿):任务段 hover
|
|
31
|
+
双按钮可见、下拉定宽 150、scrollHeight > clientHeight(容器内滚)、剪贴板载荷、
|
|
32
|
+
预览打开「原文 #2」旁路页签(`.mdw.is-beside` 在场)。
|
|
33
|
+
- 本轮知识沉淀:ref `ref_b000ae6b52e1a8d5`「面包屑二轮验收」。
|
|
34
|
+
|
|
35
|
+
## [0.68.1] - 2026-11-24 管理命名空间:搜索分区 + 成员增删
|
|
36
|
+
|
|
37
|
+
用户口径:「顶部增加搜索框,支持搜索ns。对于btn增加管理:支持管理该命名空间具体项目
|
|
38
|
+
的增删」。附图即「管理命名空间(分区)」弹窗——此前行操作只有 ↑↓ / 重命名 / 删除,
|
|
39
|
+
成员增删散在侧栏行菜单与分区头「+」里,管理弹窗里反而动不了成员。
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- 管理弹窗顶部**搜索框**:按名称 / id 过滤分区(大小写不敏感),带「N / M 个分区匹配」
|
|
44
|
+
计数;空态区分「没有分区」与「没有匹配」。
|
|
45
|
+
- 每行新增**成员**钮 → 行下展开该分区条目清单(分组/仓库 kind 标签 + 显示名 + 悬浮
|
|
46
|
+
× 移除),清单尾「+ 添加成员」复用既有成员选择弹窗(NsAddModal,带检索与多归属
|
|
47
|
+
标注)。移除走新增的 `removeItemFromNs(nsId, itemKey)`——按 items 键形直接摘出,
|
|
48
|
+
只动指定分区,登记与其它分区不受影响。
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- 重命名从 `window.prompt` 改走标准表单弹窗(重命名分区)——原生 prompt 违反面板
|
|
53
|
+
「alert/confirm/prompt 一律页内实现」红线,顺手修正;管理 → 重命名 / 添加成员
|
|
54
|
+
均按「先关后开」关闭管理弹窗再开目标弹窗。
|
|
55
|
+
|
|
56
|
+
### Verification
|
|
57
|
+
|
|
58
|
+
- 全量门禁通过:lint / typecheck / build / smoke / unit 1179/1179。
|
|
59
|
+
- Playwright 探针实测(独立 store + 注入 prefs,11 项断言全绿):搜索过滤与计数、
|
|
60
|
+
成员展开与 labelOf 名称、移除/添加后 localStorage items 落盘对账、重命名表单弹窗
|
|
61
|
+
预填值。截图目视布局正常。
|
|
62
|
+
- 本轮知识沉淀:ref `ref_37c7272803fa2c4b`「管理命名空间弹窗:顶部搜索分区 + 行内
|
|
63
|
+
成员增删 + 重命名走表单弹窗」。
|
|
64
|
+
|
|
5
65
|
## [0.68.0] - 2026-11-24 任务页 VS Code 式面包屑 + 路径复制偏好
|
|
6
66
|
|
|
7
67
|
用户口径:「希望 div.mdw-top 换成 vscode 的这种面包屑。不显示标题……点击某一个显示同级
|
package/package.json
CHANGED
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
// 重启绝不能被代码里的出厂文本覆盖(T06 裁决:builtin 标记不覆盖用户编辑)。
|
|
10
10
|
// 所以升级内置模板正文 = 改这里的出厂文本 + 用户手动重置(没有自动覆盖)。
|
|
11
11
|
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// context 组/仓库上下文(参考文档地址、关键要求)
|
|
12
|
+
// #191 起模板表只服务一件事:**按模板初始化 task 草稿**(newtask category)。
|
|
13
|
+
// 出厂只有一条「ref 生成」内置模板;delivery / enhance / context 三条提示词段
|
|
14
|
+
// 已下线(见 RETIRED_BUILTIN_TEMPLATE_IDS)——提示词模板走独立引擎
|
|
15
|
+
// (modules/promptplug/plugins/* 的 BUILTIN),与本表无关系。
|
|
17
16
|
import type { DbApi } from './driver.js';
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -93,6 +92,12 @@ export const RETIRED_BUILTIN_TEMPLATE_IDS = Object.freeze([
|
|
|
93
92
|
'newtask.feature',
|
|
94
93
|
'newtask.research',
|
|
95
94
|
'newtask.doc',
|
|
95
|
+
// #191:任务模板只负责「按模板初始化 task 草稿」,与提示词模板无关——提示词
|
|
96
|
+
// 有自己的引擎(promptplug 插件 BUILTIN,见 modules/promptplug/plugins/*)。
|
|
97
|
+
// 这三条是提示词段,历史上混在模板表里出现在任务模板列表,现下线(软删 builtin 行)。
|
|
98
|
+
'delivery.main',
|
|
99
|
+
'enhance.timegoal',
|
|
100
|
+
'context.main',
|
|
96
101
|
]);
|
|
97
102
|
|
|
98
103
|
/** 内置模板清单(顺序即 sort_order)。id 稳定:升级不改 id,用户配置跟着 id 走。 */
|
|
@@ -107,51 +112,6 @@ export const BUILTIN_TEMPLATES = Object.freeze([
|
|
|
107
112
|
vars: {},
|
|
108
113
|
isDefault: 1,
|
|
109
114
|
},
|
|
110
|
-
{
|
|
111
|
-
id: 'delivery.main',
|
|
112
|
-
category: 'delivery',
|
|
113
|
-
name: '交付文本骨架',
|
|
114
|
-
slot: 'suffix',
|
|
115
|
-
body: [
|
|
116
|
-
'{{task.text}}',
|
|
117
|
-
'',
|
|
118
|
-
'{{#if repo}}📁 项目:{{repo.name}}{{#if repo.desc}} —— {{repo.desc}}{{/if}}{{/if}}',
|
|
119
|
-
'{{#each repo.docs}}',
|
|
120
|
-
' 📄 {{this.desc}}{{#if this.refId}}(nx-kv docs get --ref {{this.refId}}){{/if}}',
|
|
121
|
-
'{{/each}}',
|
|
122
|
-
].join('\n'),
|
|
123
|
-
varsSchema: [],
|
|
124
|
-
vars: {},
|
|
125
|
-
isDefault: 1,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
id: 'enhance.timegoal',
|
|
129
|
-
category: 'enhance',
|
|
130
|
-
name: '时间目标提醒',
|
|
131
|
-
slot: 'suffix',
|
|
132
|
-
body: [
|
|
133
|
-
'{{#if goal}}',
|
|
134
|
-
'⏱ 本次任务有 {{goal.durationHuman}} 的时间目标,{{goal.remainingHuman}}内应交付;',
|
|
135
|
-
'到点前先执行 timegoal check 汇报现状,未到点不得标记完成。',
|
|
136
|
-
'{{/if}}',
|
|
137
|
-
].join('\n'),
|
|
138
|
-
varsSchema: [],
|
|
139
|
-
vars: {},
|
|
140
|
-
isDefault: 1,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
id: 'context.main',
|
|
144
|
-
category: 'context',
|
|
145
|
-
name: '仓库/组上下文',
|
|
146
|
-
slot: 'suffix',
|
|
147
|
-
body: [
|
|
148
|
-
'{{#if group}}🗂 项目组「{{group.name}}」{{#if group.desc}}:{{group.desc}}{{/if}}{{/if}}',
|
|
149
|
-
'{{#each group.docs}}\n - {{this.path}}{{/each}}',
|
|
150
|
-
].join('\n'),
|
|
151
|
-
varsSchema: [],
|
|
152
|
-
vars: {},
|
|
153
|
-
isDefault: 1,
|
|
154
|
-
},
|
|
155
115
|
]);
|
|
156
116
|
|
|
157
117
|
/**
|
package/src/web/frontend/App.tsx
CHANGED
|
@@ -129,6 +129,18 @@ function routeFromHash(): AppRoute {
|
|
|
129
129
|
scope: '',
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
+
// #151/#191:参数填写中间页(#/templates/fill/<sessionId>,会话在内存里)
|
|
133
|
+
if (rest.startsWith('fill/')) {
|
|
134
|
+
return {
|
|
135
|
+
view: 'templates',
|
|
136
|
+
key: '',
|
|
137
|
+
task: '',
|
|
138
|
+
mode: 'fill',
|
|
139
|
+
id: decodeURIComponent(rest.slice(5)),
|
|
140
|
+
topic: '',
|
|
141
|
+
scope: '',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
132
144
|
if (rest === 'new') {
|
|
133
145
|
return {
|
|
134
146
|
view: 'templates',
|
|
@@ -54,26 +54,33 @@
|
|
|
54
54
|
color: var(--ink, #16181c);
|
|
55
55
|
font-weight: 600;
|
|
56
56
|
}
|
|
57
|
-
/*
|
|
57
|
+
/* 任务段 hover 的两个 icon btn(#259:复制路径 + 预览原文)——平时隐身,
|
|
58
|
+
悬浮任务段(或键盘聚焦其按钮)才亮 */
|
|
59
|
+
.vsc-acts {
|
|
60
|
+
flex: none;
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 1px;
|
|
64
|
+
opacity: 0;
|
|
65
|
+
transition: opacity 0.12s;
|
|
66
|
+
}
|
|
67
|
+
.vsc-crumb.is-cur:hover .vsc-acts,
|
|
68
|
+
.vsc-acts:focus-within {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
58
71
|
.vsc-copy {
|
|
59
72
|
flex: none;
|
|
60
73
|
border: 0;
|
|
61
74
|
background: none;
|
|
62
75
|
cursor: pointer;
|
|
63
76
|
color: var(--mid, #838a93);
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
77
|
+
width: 22px;
|
|
78
|
+
height: 22px;
|
|
66
79
|
border-radius: 6px;
|
|
67
80
|
display: inline-flex;
|
|
68
81
|
align-items: center;
|
|
69
82
|
justify-content: center;
|
|
70
83
|
padding: 0;
|
|
71
|
-
opacity: 0;
|
|
72
|
-
transition: opacity 0.12s;
|
|
73
|
-
}
|
|
74
|
-
.vsc-crumbs:hover .vsc-copy,
|
|
75
|
-
.vsc-copy:focus-visible {
|
|
76
|
-
opacity: 1;
|
|
77
84
|
}
|
|
78
85
|
.vsc-copy:hover {
|
|
79
86
|
background: var(--soft, #f1f0ec);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// VS Code 式面包屑(任务页顶条,#254
|
|
2
|
-
//
|
|
1
|
+
// VS Code 式面包屑(任务页顶条,#254/#259):段间「>」分隔、点段弹同级下拉(定宽 150、
|
|
2
|
+
// 超高容器内滚);悬浮任务段亮出**两个** icon btn——复制(路径复制偏好两态)与预览
|
|
3
|
+
// (打开旁路原文子侧边栏,onPreview 由宿主任务页给)。
|
|
3
4
|
// 旧 RouteBreadcrumb([ 目录 / #N ] 方括号式)继续服务其余页面;任务页只换这条。
|
|
4
5
|
import { useMemo, useState } from 'react';
|
|
5
6
|
import { useApp } from '../../app-context.jsx';
|
|
@@ -14,10 +15,11 @@ import './vsc-crumbs.css';
|
|
|
14
15
|
interface MenuState {
|
|
15
16
|
x: number;
|
|
16
17
|
y: number;
|
|
18
|
+
width?: number;
|
|
17
19
|
items: Array<PopMenuItem | string>;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
export default function VscCrumbs() {
|
|
22
|
+
export default function VscCrumbs({ onPreview }: { onPreview?: (() => void) | null } = {}) {
|
|
21
23
|
const app = useApp();
|
|
22
24
|
const toast = useToast();
|
|
23
25
|
const [menu, setMenu] = useState<MenuState | null>(null);
|
|
@@ -34,6 +36,7 @@ export default function VscCrumbs() {
|
|
|
34
36
|
setMenu({
|
|
35
37
|
x: e.clientX,
|
|
36
38
|
y: e.clientY + 6,
|
|
39
|
+
width: 150, // #259 验收:下拉定宽 150px
|
|
37
40
|
items: seg.siblings.map((s: VscSibling) => ({
|
|
38
41
|
label: s.label,
|
|
39
42
|
icon: s.nsId ? 'flow' : undefined,
|
|
@@ -71,29 +74,48 @@ export default function VscCrumbs() {
|
|
|
71
74
|
return (
|
|
72
75
|
<div className="vsc-crumbs">
|
|
73
76
|
<nav className="vsc-crumbs-path" aria-label="当前位置">
|
|
74
|
-
{trail.segments.map((seg, i) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
{trail.segments.map((seg, i) => {
|
|
78
|
+
const isCur = i === trail.segments.length - 1;
|
|
79
|
+
return (
|
|
80
|
+
<span key={seg.kind} className={'vsc-crumb' + (isCur ? ' is-cur' : '')}>
|
|
81
|
+
{i > 0 && (
|
|
82
|
+
<span className="vsc-sep" aria-hidden>
|
|
83
|
+
>
|
|
84
|
+
</span>
|
|
85
|
+
)}
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
className="vsc-crumb-t"
|
|
89
|
+
disabled={!seg.siblings.length}
|
|
90
|
+
title={seg.siblings.length ? `显示「${seg.label}」的同级` : seg.label}
|
|
91
|
+
onClick={(e) => openSiblings(seg, e)}
|
|
92
|
+
>
|
|
93
|
+
{seg.label}
|
|
94
|
+
</button>
|
|
95
|
+
{/* #259 验收:任务段 hover 出两个 icon btn——复制路径 + 预览原文(旁路子侧边栏) */}
|
|
96
|
+
{isCur && (
|
|
97
|
+
<span className="vsc-acts">
|
|
98
|
+
<button type="button" className="vsc-copy" title={copyTitle} aria-label={copyTitle} onClick={copy}>
|
|
99
|
+
<Icon name="copy" size={13} />
|
|
100
|
+
</button>
|
|
101
|
+
{onPreview && (
|
|
102
|
+
<button
|
|
103
|
+
type="button"
|
|
104
|
+
className="vsc-copy"
|
|
105
|
+
title="预览原文(旁路打开)"
|
|
106
|
+
aria-label="预览原文"
|
|
107
|
+
onClick={onPreview}
|
|
108
|
+
>
|
|
109
|
+
<Icon name="eye" size={13} />
|
|
110
|
+
</button>
|
|
111
|
+
)}
|
|
112
|
+
</span>
|
|
113
|
+
)}
|
|
114
|
+
</span>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
92
117
|
</nav>
|
|
93
|
-
<
|
|
94
|
-
<Icon name="copy" size={13} />
|
|
95
|
-
</button>
|
|
96
|
-
{menu && <PopMenu x={menu.x} y={menu.y} items={menu.items} onClose={() => setMenu(null)} />}
|
|
118
|
+
{menu && <PopMenu x={menu.x} y={menu.y} width={menu.width} items={menu.items} onClose={() => setMenu(null)} />}
|
|
97
119
|
</div>
|
|
98
120
|
);
|
|
99
121
|
}
|
|
@@ -212,6 +212,8 @@ export interface PopMenuProps {
|
|
|
212
212
|
/** [{label, icon?, danger?, onClick}] 或 'sep';未标注类型的数组里 'sep' 会退化成 string,一并收 */
|
|
213
213
|
items: Array<PopMenuItem | string>;
|
|
214
214
|
onClose: () => void;
|
|
215
|
+
/** #259:固定宽度(px;缺省 168 起随内容伸)。要盖过 CSS 的 min-width,须连 minWidth 一起内联 */
|
|
216
|
+
width?: number;
|
|
215
217
|
}
|
|
216
218
|
|
|
217
219
|
/**
|
|
@@ -219,7 +221,7 @@ export interface PopMenuProps {
|
|
|
219
221
|
* @param {Array} items [{label, icon?, danger?, onClick}] 或 'sep'
|
|
220
222
|
* @param {Function} onClose
|
|
221
223
|
*/
|
|
222
|
-
export function PopMenu({ x, y, items, onClose }: PopMenuProps) {
|
|
224
|
+
export function PopMenu({ x, y, items, onClose, width }: PopMenuProps) {
|
|
223
225
|
const ref = useRef<HTMLDivElement | null>(null);
|
|
224
226
|
// DOM 边界:activeElement 声明为 Element|null,focus() 只在 HTMLElement 上有
|
|
225
227
|
const returnFocus = useRef<HTMLElement | null>(document.activeElement as HTMLElement | null);
|
|
@@ -268,6 +270,7 @@ export function PopMenu({ x, y, items, onClose }: PopMenuProps) {
|
|
|
268
270
|
const style: CSSProperties = {
|
|
269
271
|
left: Math.min(x ?? 0, window.innerWidth - 190),
|
|
270
272
|
top: Math.min(y ?? 0, window.innerHeight - 40 - items.length * 30),
|
|
273
|
+
...(width ? { width, minWidth: width } : {}),
|
|
271
274
|
};
|
|
272
275
|
|
|
273
276
|
return (
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
.pp-menu {
|
|
54
54
|
position: fixed; z-index: 100; min-width: 168px; background: var(--paper); border: 1px solid var(--soft-2);
|
|
55
55
|
border-radius: 8px; box-shadow: var(--shadow); padding: 4px; animation: pp-pop 0.1s ease;
|
|
56
|
+
/* #259:固定最大高度——同级清单长了在容器内滚,不再把菜单顶出视口 */
|
|
57
|
+
max-height: min(60vh, 440px); overflow-y: auto;
|
|
56
58
|
}
|
|
57
59
|
.rowmenu .pp-menu { position: absolute; top: calc(100% + 4px); right: 0; left: auto; }
|
|
58
60
|
.pp-menu-item {
|
|
@@ -191,7 +191,7 @@ export default function Sidebar({
|
|
|
191
191
|
|
|
192
192
|
// #178:分区装配(操作 + 成员选择弹窗 + 候选)全部收在 use-sidebar-ns(纯显示态)
|
|
193
193
|
const nsOps = useSidebarNs({ patchPrefs, toast, dialog, setMenu, repos, boards, namespaces: prefs.namespaces });
|
|
194
|
-
const { nsForm, setNsForm, addFor, setAddFor, candidatesFor, manageOpen, setManageOpen, observeOpen, setObserveOpen, labelOf, setFocusNs, moveNs, removeNs, renameNs, newNsAndMove, addToNs, dropToCurrent, openNsMenu, toggleNsCollapse, moveToNs, removeFromNs } = nsOps;
|
|
194
|
+
const { nsForm, setNsForm, addFor, setAddFor, candidatesFor, manageOpen, setManageOpen, observeOpen, setObserveOpen, labelOf, setFocusNs, moveNs, removeNs, renameNs, newNsAndMove, addToNs, removeItemFromNs, dropToCurrent, openNsMenu, toggleNsCollapse, moveToNs, removeFromNs } = nsOps;
|
|
195
195
|
|
|
196
196
|
// 点击:看板 = 进组视图(成员仍在组面板里下拉选择,树里不铺成员仓库;
|
|
197
197
|
// 但 chevron 可展开**本组任务**子行,与仓库行的任务子行同构);
|
|
@@ -574,11 +574,13 @@ export default function Sidebar({
|
|
|
574
574
|
namespaces={prefs.namespaces || []}
|
|
575
575
|
focusNs={String((prefs as any).focusNs || '')}
|
|
576
576
|
onManageClose={() => setManageOpen(false)}
|
|
577
|
-
|
|
577
|
+
onEditNsName={(id, name) => { setManageOpen(false); setNsForm({ id, name }); }}
|
|
578
578
|
onMoveNs={(id, d) => moveNs(id, d)}
|
|
579
579
|
onRemoveNs={(id) => removeNs(id)}
|
|
580
580
|
onNewNs={() => setNsForm({ id: '', name: '' })}
|
|
581
581
|
onFocusNs={(id) => setFocusNs(id)}
|
|
582
|
+
onAddToNs={(id) => { setManageOpen(false); setAddFor(id); }}
|
|
583
|
+
onRemoveNsItem={(nsId, key) => { removeItemFromNs(nsId, key); toast('已从分区移除'); }}
|
|
582
584
|
observeOpen={observeOpen}
|
|
583
585
|
onObserveClose={() => setObserveOpen(false)}
|
|
584
586
|
labelOf={labelOf}
|
|
@@ -23,11 +23,15 @@ export interface NsDialogsProps {
|
|
|
23
23
|
namespaces: SidebarNs[];
|
|
24
24
|
focusNs?: string;
|
|
25
25
|
onManageClose: () => void;
|
|
26
|
-
|
|
26
|
+
/** #256:重命名改走标准表单弹窗(宿主负责关管理弹窗再开表单),不再用原生 prompt */
|
|
27
|
+
onEditNsName: (id: string, name: string) => void;
|
|
27
28
|
onMoveNs: (id: string, dir: -1 | 1) => void;
|
|
28
29
|
onRemoveNs: (id: string) => void;
|
|
29
30
|
onNewNs: () => void;
|
|
30
31
|
onFocusNs: (id: string) => void;
|
|
32
|
+
/** #256:管理弹窗内的成员增删(添加 = 关管理弹窗呼出成员选择;移除 = 只摘出该分区) */
|
|
33
|
+
onAddToNs: (id: string) => void;
|
|
34
|
+
onRemoveNsItem: (nsId: string, itemKey: string) => void;
|
|
31
35
|
/** #181:详情观察 */
|
|
32
36
|
observeOpen: boolean;
|
|
33
37
|
onObserveClose: () => void;
|
|
@@ -45,11 +49,14 @@ export default function NsDialogs(p: NsDialogsProps) {
|
|
|
45
49
|
namespaces={p.namespaces}
|
|
46
50
|
focusNs={p.focusNs}
|
|
47
51
|
onClose={p.onManageClose}
|
|
48
|
-
|
|
52
|
+
onEditName={p.onEditNsName}
|
|
49
53
|
onMove={p.onMoveNs}
|
|
50
54
|
onRemove={p.onRemoveNs}
|
|
51
55
|
onNew={() => { p.onManageClose(); p.onNewNs(); }}
|
|
52
56
|
onFocus={p.onFocusNs}
|
|
57
|
+
onAddItems={p.onAddToNs}
|
|
58
|
+
onRemoveItem={p.onRemoveNsItem}
|
|
59
|
+
labelOf={p.labelOf}
|
|
53
60
|
/>
|
|
54
61
|
) : null}
|
|
55
62
|
{p.observeOpen ? (
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// 分区管理弹窗(#179):命名空间是**切换器**——管理动作(重命名 / 排序 / 删除 / 新建)
|
|
2
2
|
// 统一收进这里,侧栏里不再叠一排分区头行做管理入口。
|
|
3
|
+
// #256 增补:顶部搜索框(分区多了以后按名找)+ 每行「成员」展开该分区的条目清单,
|
|
4
|
+
// 在清单里直接移除 / 呼出成员添加弹窗;重命名改走标准表单弹窗(原生 prompt 已废)。
|
|
5
|
+
import { useMemo, useState } from 'react';
|
|
3
6
|
import { Modal } from '../popup/index.jsx';
|
|
4
7
|
import { Button } from '../button/index.js';
|
|
8
|
+
import { Icon } from '../icons.jsx';
|
|
5
9
|
import type { SidebarNs } from '../../types.js';
|
|
6
10
|
|
|
7
11
|
export interface NsManageModalProps {
|
|
@@ -9,42 +13,95 @@ export interface NsManageModalProps {
|
|
|
9
13
|
/** 当前聚焦的命名空间 id(高亮) */
|
|
10
14
|
focusNs?: string;
|
|
11
15
|
onClose: () => void;
|
|
12
|
-
|
|
16
|
+
/** 重命名:打开标准表单弹窗(宿主负责关本弹窗),不再用原生 prompt */
|
|
17
|
+
onEditName: (id: string, name: string) => void;
|
|
13
18
|
onMove: (id: string, dir: -1 | 1) => void;
|
|
14
19
|
onRemove: (id: string) => void;
|
|
15
20
|
onNew: () => void;
|
|
16
21
|
onFocus: (id: string) => void;
|
|
22
|
+
/** #256:呼出「向该分区添加成员」弹窗(宿主负责关本弹窗) */
|
|
23
|
+
onAddItems: (id: string) => void;
|
|
24
|
+
/** #256:从该分区移除一个条目(items 键形:'board:<id>' | '<仓库key>') */
|
|
25
|
+
onRemoveItem: (nsId: string, itemKey: string) => void;
|
|
26
|
+
/** 条目键 → 显示名(宿主的 labelOf) */
|
|
27
|
+
labelOf: (key: string) => string;
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
export default function NsManageModal({
|
|
20
|
-
namespaces, focusNs, onClose,
|
|
31
|
+
namespaces, focusNs, onClose, onEditName, onMove, onRemove, onNew, onFocus,
|
|
32
|
+
onAddItems, onRemoveItem, labelOf,
|
|
21
33
|
}: NsManageModalProps) {
|
|
22
34
|
const list = Array.isArray(namespaces) ? namespaces : [];
|
|
35
|
+
const [filter, setFilter] = useState('');
|
|
36
|
+
const [expandedId, setExpandedId] = useState<string | null>(null);
|
|
37
|
+
const q = filter.trim().toLowerCase();
|
|
38
|
+
const shown = useMemo(
|
|
39
|
+
() => (q ? list.filter((n) => (n.name || '').toLowerCase().includes(q) || n.id.toLowerCase().includes(q)) : list),
|
|
40
|
+
[list, q]
|
|
41
|
+
);
|
|
42
|
+
const expanded = expandedId ? list.find((n) => n.id === expandedId) : null;
|
|
43
|
+
|
|
23
44
|
return (
|
|
24
45
|
<Modal title="管理命名空间(分区)" onClose={onClose}>
|
|
46
|
+
{/* #256:按名称 / id 搜索分区——分区一多,扫列表比搜索慢得多 */}
|
|
47
|
+
<label className="sbox ns-manage-search">
|
|
48
|
+
<input
|
|
49
|
+
value={filter}
|
|
50
|
+
placeholder="搜索命名空间…"
|
|
51
|
+
autoFocus
|
|
52
|
+
onChange={(e) => setFilter(e.target.value)}
|
|
53
|
+
onKeyDown={(e) => { if (e.key === 'Escape') setFilter(''); }}
|
|
54
|
+
/>
|
|
55
|
+
</label>
|
|
56
|
+
{q ? <div className="ns-add-filter-note">{shown.length} / {list.length} 个分区匹配</div> : null}
|
|
25
57
|
<div className="ns-add-list">
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{n.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
{shown.length ? (
|
|
59
|
+
shown.map((n, i) => {
|
|
60
|
+
const isExpanded = expandedId === n.id;
|
|
61
|
+
return (
|
|
62
|
+
<div key={n.id} className={'ns-manage-cell' + (n.id === focusNs ? ' is-on' : '')}>
|
|
63
|
+
<div className={'ns-manage-row' + (n.id === focusNs ? ' is-on' : '')}>
|
|
64
|
+
<button type="button" className="ns-manage-name" title="切换到这个命名空间"
|
|
65
|
+
onClick={() => { onFocus(n.id); onClose(); }}>
|
|
66
|
+
{n.pinned ? '★ ' : ''}{n.name}
|
|
67
|
+
<span className="ns-manage-count">{n.items.length} 项</span>
|
|
68
|
+
</button>
|
|
69
|
+
<span className="ns-manage-acts">
|
|
70
|
+
<Button small variant="secondary" title={isExpanded ? '收起成员' : '管理成员(增删)'}
|
|
71
|
+
onClick={() => setExpandedId(isExpanded ? null : n.id)}>成员</Button>
|
|
72
|
+
<Button small variant="secondary" disabled={i === 0} title="上移" onClick={() => onMove(n.id, -1)}>↑</Button>
|
|
73
|
+
<Button small variant="secondary" disabled={i === list.length - 1} title="下移" onClick={() => onMove(n.id, 1)}>↓</Button>
|
|
74
|
+
<Button small variant="secondary" title="重命名"
|
|
75
|
+
onClick={() => onEditName(n.id, n.name)}>重命名</Button>
|
|
76
|
+
<Button small variant="secondary" danger title="删除命名空间(其它命名空间不受影响)" onClick={() => onRemove(n.id)}>删除</Button>
|
|
77
|
+
</span>
|
|
78
|
+
</div>
|
|
79
|
+
{isExpanded && expanded ? (
|
|
80
|
+
<div className="ns-manage-items">
|
|
81
|
+
{expanded.items.length ? (
|
|
82
|
+
expanded.items.map((k) => (
|
|
83
|
+
<div key={k} className="ns-manage-item" title={k}>
|
|
84
|
+
<span className={'ns-add-kind ' + (k.startsWith('board:') ? 'board' : 'repo')}>
|
|
85
|
+
{k.startsWith('board:') ? '分组' : '仓库'}
|
|
86
|
+
</span>
|
|
87
|
+
<span className="ns-manage-item-name">{labelOf(k)}</span>
|
|
88
|
+
<button type="button" className="ns-manage-item-del" title="从该分区移除(登记与其它分区不受影响)"
|
|
89
|
+
onClick={() => onRemoveItem(n.id, k)}>
|
|
90
|
+
<Icon name="x" size={12} />
|
|
91
|
+
</button>
|
|
92
|
+
</div>
|
|
93
|
+
))
|
|
94
|
+
) : (
|
|
95
|
+
<div className="setp-note">空分区——用下面「添加成员」或拖拽侧栏行加入。</div>
|
|
96
|
+
)}
|
|
97
|
+
<Button small variant="secondary" onClick={() => onAddItems(n.id)}>+ 添加成员</Button>
|
|
98
|
+
</div>
|
|
99
|
+
) : null}
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
})
|
|
46
103
|
) : (
|
|
47
|
-
<div className="setp-note"
|
|
104
|
+
<div className="setp-note">{q ? '没有匹配的命名空间——换个关键词试试。' : '还没有命名空间——点下面「新建」开始。'}</div>
|
|
48
105
|
)}
|
|
49
106
|
</div>
|
|
50
107
|
<div className="form-acts">
|
|
@@ -116,6 +116,16 @@ export function useNamespaces({ patchPrefs, toast, dialog, setMenu }: UseNsArgs)
|
|
|
116
116
|
},
|
|
117
117
|
[withNs]
|
|
118
118
|
);
|
|
119
|
+
/** #256:管理弹窗里按**条目键**移除(无需 SideRow——键形与 items 一致:'board:<id>' | '<仓库key>')。
|
|
120
|
+
只从指定分区移除,登记与其它分区不受影响。 */
|
|
121
|
+
const removeItemFromNs = useCallback(
|
|
122
|
+
(nsId: string, itemKey: string) => {
|
|
123
|
+
const k = String(itemKey || '');
|
|
124
|
+
if (!k) return;
|
|
125
|
+
withNs((list) => list.map((n) => (n.id !== nsId ? n : { ...n, items: n.items.filter((x) => x !== k) })));
|
|
126
|
+
},
|
|
127
|
+
[withNs]
|
|
128
|
+
);
|
|
119
129
|
const newNsAndMove = useCallback(
|
|
120
130
|
(name: string, moveKey: string | null) => {
|
|
121
131
|
const k = String(moveKey || '');
|
|
@@ -174,5 +184,5 @@ export function useNamespaces({ patchPrefs, toast, dialog, setMenu }: UseNsArgs)
|
|
|
174
184
|
[dialog, moveNs, removeNs, toggleNsCollapse, toggleNsPinned]
|
|
175
185
|
);
|
|
176
186
|
|
|
177
|
-
return { nsForm, setNsForm, toggleNsCollapse, moveToNs, addToNs, removeFromNs, newNsAndMove, renameNs, openNsMenu, setFocusNs, moveNs, removeNs };
|
|
187
|
+
return { nsForm, setNsForm, toggleNsCollapse, moveToNs, addToNs, removeFromNs, removeItemFromNs, newNsAndMove, renameNs, openNsMenu, setFocusNs, moveNs, removeNs };
|
|
178
188
|
}
|
|
@@ -370,6 +370,7 @@ export default function TaskPage({
|
|
|
370
370
|
projectTag={r.projectTag}
|
|
371
371
|
projectTitle={r.projectTitle}
|
|
372
372
|
searchCtx={searching ? contextOf(r.task, q) : null}
|
|
373
|
+
searchQuery={searching ? String(q || '') : ''}
|
|
373
374
|
selectable
|
|
374
375
|
picked={picked.has(r.key)}
|
|
375
376
|
onTogglePick={() => togglePick(r.key)}
|