Commit 7cc7d60d by 胡悦

feat(admin-web): 实现本地管理员登录、Agent列表与管理后台框架

配置 Tailwind CSS 作为项目样式工具
实现本地登录认证逻辑,包含登录态本地持久化与退出登录功能
添加路由保护守卫,拦截未登录用户访问后台页面
新增管理后台布局框架,包含导航菜单与用户退出控件
新增 Agent 管理列表页,支持关键词筛选、岗位筛选、分页与状态展示
更新组件库,新增状态占位组件、导航组件,修复 Select 下拉自动收起与分页选中态问题
新增前端契约文件目录,定义 Agent 列表 mock 数据规范
清理过时文档文件,重构 AGENTS.md 文档结构
新增管理员登录与管理后台框架的 OpenSpec 规范文件
1 parent be1840bf
Showing 60 changed files with 4036 additions and 564 deletions
# Codex 项目规则
## OpenSpec + Superpowers 工作流
对于非平凡 feature,默认使用四阶段组合流程:
1. Superpowers 探索性规划。
2. OpenSpec 锁定规范。
3. Superpowers 执行编码、测试、验证。
4. OpenSpec 归档。
详细使用说明见 `architecture-spec/docs/architecture/openspec-superpowers-workflow.md`。
### 阶段速查
- Superpowers 探索性规划:读取上下文、澄清需求、比较方案、确认设计;常用触发语:`使用 $superpowers-openspec-execution-workflow,先进入 Superpowers 探索阶段,不要写代码。`
- OpenSpec 锁定规范:创建 `openspec/changes/<change-name>/`,按顺序完成 `proposal.md`、`design.md`、`specs/.../spec.md`、`tasks.md`;常用命令:`openspec status --change "<change-name>" --json`、`openspec instructions <artifact> --change "<change-name>" --json`、`openspec validate "<change-name>" --strict`。
- Superpowers 执行编码、测试、验证:按 OpenSpec tasks 和实施计划用 TDD 实现,运行类型检查、测试、构建和必要的浏览器验证;常用命令:`npm run typecheck`、`npm test`、`npm run build`。
- OpenSpec 归档:确认代码、测试、规范对齐后归档;常用命令:`openspec archive "<change-name>"`。
## 强制规则
- 设计未确认前,不进入 OpenSpec。
- OpenSpec artifacts 未完成前,不进入编码。
- 行为变更默认使用 TDD。
- 完成前必须运行真实验证命令。
- 代码、测试、规范未对齐前,不归档。
- 需求确认前,不写业务实现代码。
- 在业务需求最终确认前,可以先创建项目级规范、架构决策、前端组件规则和页面数据草案。
- 每个会改变系统行为的功能,都必须在 `openspec/changes/<change-name>/` 下有对应的 OpenSpec change。
## 文档优先
文档按以下位置归档:
- `architecture-spec/docs/architecture/`:全局技术规范。
- `architecture-spec/docs/requirements/`:PRD 分析、待确认问题、确认记录。
- `architecture-spec/docs/decisions/`:长期有效的架构和产品决策。
- `architecture-spec/openspec/`:全局 OpenSpec 规范和工作区级 change。
- `workspace/<project>/openspec/`:具体业务项目的 OpenSpec 规范和 change。
- `workspace/<project>/docs/`:具体业务项目文档。
- `.superpowers-memory/`:跨会话项目记忆。其中 `CURRENT_STATE.md` 仅作为状态索引;具体当前状态按“人/项目”写入 `.superpowers-memory/current/<owner>/<project>.md`,避免多人协作时反复冲突。
## 前端规则
- 所有 Web 桌面端页面必须遵循公司设计规范:`/Users/yuehu/Documents/广联web桌面端设计规范`。
- 优先使用可复用的内部组件,不在页面里临时堆一次性 UI。
- 管理后台页面应保持信息密度和可扫读性:工具栏/搜索区、表格、分页、弹窗/抽屉表单、状态标签、清晰的操作按钮。
- 后台工作流页面不要做成营销页风格。
## 后端规则
- 后端技术栈暂不固化,后续可根据确认结果选择 Python 或其他方案。
- 当前阶段不制定后端框架、数据库、队列、ORM 和运行时实现规则。
- 如前端需要联调契约,先以页面字段、交互状态、错误展示和 mock 数据结构表达,不锁定服务端实现。
## 验证规则
- 没有新鲜的验证结果,不声明工作完成。
- 如果改了代码,需要运行类型检查和相关测试。
- 如果开发前端页面,完成前需要在浏览器中验证布局和关键交互。
# Superpowers 配置目录
这里用于存放本项目的 Superpowers 工作流配置、团队约定或与外部 skills bundle 的引用说明。
当前项目默认使用本机已安装的 Superpowers/OpenSpec 相关 skills。若后续团队决定统一使用 `superpowers-openspec-team-skills`,可在这里补充安装和同步说明。
# Agent 规则入口 # Agent 项目规则
本项目 Codex 规则以 `.codex/AGENTS.md` 为准。 ## OpenSpec + Superpowers 工作流
进入本仓库工作时,请优先读取并遵循 `.codex/AGENTS.md`。根目录保留此入口文件,是为了兼容 Codex 和其他 Agent 工具在仓库根目录自动发现 `AGENTS.md` 的习惯。 对于非平凡 feature,默认使用四阶段组合流程:
1. Superpowers 探索性规划。
2. OpenSpec 锁定规范。
3. Superpowers 执行编码、测试、验证。
4. OpenSpec 归档。
详细使用说明见 `architecture-spec/docs/architecture/openspec-superpowers-workflow.md`。
### 阶段速查
- Superpowers 探索性规划:读取上下文、澄清需求、比较方案、确认设计;常用触发语:`使用 $superpowers-openspec-execution-workflow,先进入 Superpowers 探索阶段,不要写代码。`
- `@fixbug + <change name> + 描述内容`:如果用户明确指定对应的 OpenSpec change,则直接修改该 change 下受影响的 OpenSpec artifacts 与 `tasks.md`;如果未指定,则先检查是否已有对应 OpenSpec,若没有则创建新的 change,若已有则先更新受影响的 OpenSpec artifacts 与 `tasks.md`。用户确认文档后,再进入代码修改,不直接改代码。
- OpenSpec 锁定规范:创建 `openspec/changes/<change-name>/`,按顺序完成 `proposal.md`、`design.md`、`specs/.../spec.md`、`tasks.md`;常用命令:`openspec status --change "<change-name>" --json`、`openspec instructions <artifact> --change "<change-name>" --json`、`openspec validate "<change-name>" --strict`。
- Superpowers 执行编码、测试、验证:按 OpenSpec tasks 和实施计划用 TDD 实现,运行类型检查、测试、构建和必要的浏览器验证;常用命令:`npm run typecheck`、`npm test`、`npm run build`。
- OpenSpec 归档:确认代码、测试、规范对齐后归档;常用命令:`openspec archive "<change-name>"`。
## 强制规则
- 设计未确认前,不进入 OpenSpec。
- OpenSpec artifacts 未完成前,不进入编码。
- 当某个需求已进入对应的 OpenSpec change 后,用户后续新增问题、补充约束、要求调整方案或实现路径时,必须先更新受影响的 OpenSpec artifacts 和 `tasks.md`,并在用户确认后再进入编码。
- 行为变更默认使用 TDD。
- 完成前必须运行真实验证命令。
- 代码、测试、规范未对齐前,不归档。
- 需求确认前,不写业务实现代码。
- 所有会修改系统行为的 bug 修复,必须先对齐对应的 OpenSpec:如果用户已明确指定 change name,则直接更新该 change 下相关 artifacts 和 `tasks.md`;如果未指定,则按原流程判断,没有对应 change 时先创建新的 change,已有对应 change 时先更新相关 artifacts 和 `tasks.md`。在用户确认文档前,不直接修改代码。
- 在业务需求最终确认前,可以先创建项目级规范、架构决策、前端组件规则和页面数据草案。
- 每个会改变系统行为的功能,都必须在 `openspec/changes/<change-name>/` 下有对应的 OpenSpec change。
## 文档优先
文档按以下位置归档:
- `architecture-spec/docs/architecture/`:全局技术规范。
- `architecture-spec/docs/requirements/`:PRD 分析、待确认问题、确认记录。
- `architecture-spec/docs/decisions/`:长期有效的架构和产品决策。
- `architecture-spec/openspec/`:全局 OpenSpec 规范和工作区级 change。
- `workspace/<project>/openspec/`:具体业务项目的 OpenSpec 规范和 change。
- `workspace/<project>/docs/`:具体业务项目文档。
- `.superpowers-memory/`:跨会话项目记忆。其中 `CURRENT_STATE.md` 仅作为状态索引;具体当前状态按“人/项目”写入 `.superpowers-memory/current/<owner>/<project>.md`,避免多人协作时反复冲突。
## 文档语言
- 本仓库的 OpenSpec、需求沉淀、设计说明、任务清单、架构决策和协作说明默认使用中文。
- 代码标识、接口字段、枚举值、命令、路径、文件名、依赖名和 OpenSpec 校验所需关键字可以保留英文。
- 如必须引用英文原文,应补充中文说明,避免只留下英文规格或任务描述。
## 前端规则
- 所有 Web 桌面端页面必须遵循公司设计规范:`/Users/yuehu/Documents/广联web桌面端设计规范`。
- 优先使用可复用的内部组件,不在页面里临时堆一次性 UI。
- 管理后台页面应保持信息密度和可扫读性:工具栏/搜索区、表格、分页、弹窗/抽屉表单、状态标签、清晰的操作按钮。
- 后台工作流页面不要做成营销页风格。
## 后端规则
- 后端技术栈暂不固化,后续可根据确认结果选择 Python 或其他方案。
- 当前阶段不制定后端框架、数据库、队列、ORM 和运行时实现规则。
- 如前端需要联调契约,先以页面字段、交互状态、错误展示和 mock 数据结构表达,不锁定服务端实现。
## 验证规则
- 没有新鲜的验证结果,不声明工作完成。
- 如果改了代码,需要运行类型检查和相关测试。
- 如果开发前端页面,完成前需要在浏览器中验证布局和关键交互。
# 多项目前端工作区 # 多项目前端工作区
这是一个独立新建的 monorepo 工作区,用于沉淀 Codex + OpenSpec + Superpowers 工作流、公司 Web 桌面端设计规范、前端工程规则和后续多个项目可复用的组件规范。 这是一个独立新建的 monorepo 工作区,用于沉淀 OpenSpec + Superpowers 工作流、公司 Web 桌面端设计规范、前端工程规则和后续多个项目可复用的组件规范。
首个业务项目是 AI 大模型后台管理平台,放在 `workspace/agent-admin/`。当前阶段只沉淀项目规范和需求确认流程;业务开发需等待 PRD 二次确认、OpenSpec change 完成并获得确认后再开始。 首个业务项目是 AI 大模型后台管理平台,放在 `workspace/agent-admin/`。当前阶段只沉淀项目规范和需求确认流程;业务开发需等待 PRD 二次确认、OpenSpec change 完成并获得确认后再开始。
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
## 目录结构 ## 目录结构
```text ```text
.codex/ # Codex 工作流配置,当前受本机沙箱限制暂未创建 AGENTS.md # 工作区级 Agent 协作规则
.agents/ # 团队 skills 引用,当前受本机沙箱限制暂未创建 .agents/ # 团队 skills 引用,当前受本机沙箱限制暂未创建
architecture-spec/ # 全局架构、OpenSpec、UI 和工程规范 architecture-spec/ # 全局架构、OpenSpec、UI 和工程规范
workspace/agent-admin/ # 首个业务项目:Agent 管理平台 workspace/agent-admin/ # 首个业务项目:Agent 管理平台
...@@ -24,7 +24,7 @@ workspace/agent-admin/ # 首个业务项目:Agent 管理平台 ...@@ -24,7 +24,7 @@ workspace/agent-admin/ # 首个业务项目:Agent 管理平台
## 工作流 ## 工作流
本项目采用 Codex + OpenSpec + Superpowers 工作流: 本项目采用 OpenSpec + Superpowers 工作流:
1. Superpowers 负责需求澄清、方案比较、设计和计划。 1. Superpowers 负责需求澄清、方案比较、设计和计划。
2. OpenSpec 负责锁定行为规范和变更任务。 2. OpenSpec 负责锁定行为规范和变更任务。
......
...@@ -6,16 +6,14 @@ ...@@ -6,16 +6,14 @@
它需要沉淀三类共享资产: 它需要沉淀三类共享资产:
- 工作流资产:Codex + OpenSpec + Superpowers 的需求澄清、规范、计划、验证流程。 - 工作流资产:OpenSpec + Superpowers 的需求澄清、规范、计划、验证流程。
- UI 资产:公司 Web 桌面端设计 token、组件库、页面模式。 - UI 资产:公司 Web 桌面端设计 token、组件库、页面模式。
- 工程资产:前端通用配置、工具链、测试基线。 - 工程资产:前端通用配置、工具链、测试基线。
## 推荐目录 ## 推荐目录
```text ```text
.codex/ AGENTS.md # 工作区级 Agent 协作规则
AGENTS.md # Codex 全局工作规则
superpowers/ # Superpowers 相关配置或引用
.agents/ .agents/
skills/ # 团队级 skills 引用 skills/ # 团队级 skills 引用
...@@ -56,6 +54,28 @@ workspace/ ...@@ -56,6 +54,28 @@ workspace/
docs/ docs/
``` ```
推荐目录职责示例(以 `workspace/agent-admin/` 为例):
| 模块 | 职责 |
| --- | --- |
| `AGENTS.md` | 仓库规则入口,统一承载项目级规则、OpenSpec + Superpowers 工作流门禁,以及不同 IDE / Agent 的协作约束。 |
| `architecture-spec/` | 全局规范中心,沉淀架构、技术栈、组件规范、决策和工作区级 OpenSpec。 |
| `workspace/agent-admin/` | Agent 管理相关业务项目总目录。 |
| `workspace/agent-admin/web/` | 后台管理前端,当前可承载 React + TypeScript + Vite 等前端基座。 |
| `workspace/agent-admin/single-page/` | Agent 管理相关单页面项目,适合承载独立展示或轻量交互场景。 |
| `workspace/agent-admin/backend/` | 后端预留区,当前只定义目录边界,不预先锁定技术栈。 |
| `workspace/agent-admin/web/packages/ui/` | 后台前端可复用 UI 组件。 |
| `workspace/agent-admin/web/packages/contracts/` | 后台前端视角的字段、枚举、payload、mock 数据和接口契约沉淀区。 |
| `workspace/agent-admin/web/packages/config/` | 后台前端工程配置。 |
| `workspace/agent-admin/web/packages/utils/` | 无业务上下文的前端通用工具。 |
| `workspace/agent-admin/single-page/packages/ui/` | 单页面项目可复用 UI 组件。 |
| `workspace/agent-admin/single-page/packages/contracts/` | 单页面项目视角的字段、枚举、payload、mock 数据和接口契约沉淀区。 |
| `workspace/agent-admin/single-page/packages/config/` | 单页面项目工程配置。 |
| `workspace/agent-admin/single-page/packages/utils/` | 单页面项目通用工具。 |
| `workspace/agent-admin/backend/packages/contracts/` | 后端视角的接口、schema、错误码和 mock 响应示例。 |
| `workspace/agent-admin/backend/packages/config/` | 后端工程配置。 |
| `workspace/agent-admin/backend/packages/utils/` | 无业务上下文的后端通用工具。 |
## 命名规则 ## 命名规则
- workspace 项目命名:`<domain>-admin`、`<domain>-portal` 或明确业务域名。 - workspace 项目命名:`<domain>-admin`、`<domain>-portal` 或明确业务域名。
......
...@@ -28,7 +28,7 @@ OpenSpec 负责“把行为变更固化为规范”:proposal、design、spec ...@@ -28,7 +28,7 @@ OpenSpec 负责“把行为变更固化为规范”:proposal、design、spec
应做事项: 应做事项:
- 读取项目上下文,例如 `.codex/AGENTS.md`、`README.md`、`.superpowers-memory/`、现有 docs、OpenSpec changes 和相关代码。 - 读取项目上下文,例如根目录 `AGENTS.md`、`README.md`、`.superpowers-memory/`、现有 docs、OpenSpec changes 和相关代码。
- 一次只问一个澄清问题。 - 一次只问一个澄清问题。
- 明确目标、非目标、约束、成功标准和风险。 - 明确目标、非目标、约束、成功标准和风险。
- 给出 2-3 个可选方案,说明取舍,并推荐一个。 - 给出 2-3 个可选方案,说明取舍,并推荐一个。
...@@ -110,6 +110,7 @@ openspec/changes/<change-name>/ ...@@ -110,6 +110,7 @@ openspec/changes/<change-name>/
- 写每个 artifact 前,先运行对应的 `openspec instructions`。 - 写每个 artifact 前,先运行对应的 `openspec instructions`。
- 按依赖顺序完成 `proposal.md`、`design.md`、`specs/.../spec.md`、`tasks.md`。 - 按依赖顺序完成 `proposal.md`、`design.md`、`specs/.../spec.md`、`tasks.md`。
- 使用 `openspec validate "<change-name>" --strict` 校验。 - 使用 `openspec validate "<change-name>" --strict` 校验。
- 如果 change 已存在,且用户后续新增问题、补充约束、要求调整方案或实现路径,先回到本阶段更新受影响的 OpenSpec artifacts 和 `tasks.md`。
- 用户确认 OpenSpec artifacts 后,才能进入编码。 - 用户确认 OpenSpec artifacts 后,才能进入编码。
退出条件: 退出条件:
...@@ -121,6 +122,7 @@ openspec/changes/<change-name>/ ...@@ -121,6 +122,7 @@ openspec/changes/<change-name>/
禁止事项: 禁止事项:
- OpenSpec artifacts 未完成前,不进入编码。 - OpenSpec artifacts 未完成前,不进入编码。
- change 已存在但 OpenSpec artifacts 和 `tasks.md` 尚未同步最新讨论结果、或尚未再次获得用户确认前,不进入编码。
- 不把命令输出里的 instruction metadata 直接复制到 artifact。 - 不把命令输出里的 instruction metadata 直接复制到 artifact。
- 不为无关重构创建混合 change。 - 不为无关重构创建混合 change。
...@@ -244,3 +246,60 @@ OpenSpec 已确认、准备实现时: ...@@ -244,3 +246,60 @@ OpenSpec 已确认、准备实现时:
```text ```text
检查代码、测试和 OpenSpec 是否对齐;如果对齐,归档 <change-name>。 检查代码、测试和 OpenSpec 是否对齐;如果对齐,归档 <change-name>。
``` ```
## 提示词举例
建议按“阶段 + 约束 + 产物”的方式写提示词。这样可以让 Agent 清楚知道当前是在探索、锁规范、实现,还是归档,也能避免过早写代码或遗漏验证。
| 场景 | 提示词模板 | 预期产物 |
| --- | --- | --- |
| 需求探索 | 使用 `$superpowers-openspec-execution-workflow`,先进入 Superpowers 探索阶段,不要写代码。需求是:`<需求描述>`。请先澄清边界、成功标准和风险,并给出 2-3 个方案。 | 需求边界、方案比较、推荐方案、待确认问题 |
| 设计确认 | 基于刚才的探索结论,整理一版设计确认稿。请明确目标、非目标、用户流程、关键状态、异常场景和后续 OpenSpec change name 建议。 | 设计说明、确认项、change name 建议 |
| 锁定规范 | 基于已确认设计,进入 OpenSpec 锁定规范阶段,change name 使用 `<change-name>`。请先运行 `openspec status` 和对应 `openspec instructions`,再创建 proposal、design、spec 和 tasks。 | OpenSpec artifacts、严格校验结果 |
| 执行实现 | 按 `<change-name>` 的 OpenSpec tasks 执行实现。请使用 TDD,逐项完成 tasks,完成前运行类型检查、测试、构建和必要的浏览器验证。 | 代码变更、测试、验证结果、tasks 更新 |
| 前后端协作 | 围绕 `<业务场景>` 先做前后端契约对齐。请输出页面字段、接口字段、状态枚举、错误码、Mock 数据和联调检查清单,不要先写后端实现。 | 契约草案、Mock 数据、联调清单 |
| 归档收尾 | 检查 `<change-name>` 的代码、测试、tasks 和长期 spec 是否一致;如果一致,执行 OpenSpec 归档,并同步必要的项目记忆。 | 归档后的 specs、change 状态、记忆更新 |
### 可直接复制的完整提示词
新功能从探索开始:
```text
使用 $superpowers-openspec-execution-workflow,先进入 Superpowers 探索阶段,不要写代码。
需求是:<这里写需求>。
请先读取项目规则和相关上下文,帮我明确:
1. 目标和非目标;
2. 关键用户流程;
3. 需要确认的问题;
4. 2-3 个可选方案及取舍;
5. 推荐方案和建议的 OpenSpec change name。
```
前后端契约先行:
```text
围绕 <业务场景> 做前后端协作设计,先不要实现。
请输出:
1. 前端页面字段和交互状态;
2. 后端接口列表、请求参数、响应字段;
3. 状态枚举、错误码和权限边界;
4. 前端 Mock 数据结构;
5. 联调检查清单;
6. 哪些内容需要进入 OpenSpec spec。
```
OpenSpec 到实现:
```text
基于已确认设计,进入 OpenSpec 锁定规范阶段,change name 使用 <change-name>。
请按顺序执行:
1. 运行 openspec status --change "<change-name>" --json;
2. 针对 proposal、design、spec、tasks 分别读取 openspec instructions;
3. 创建并完善 OpenSpec artifacts;
4. 运行 openspec validate "<change-name>" --strict;
5. 等我确认后,再按 tasks 使用 TDD 实现并运行验证。
```
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
- 定义默认前端技术栈、组件规则和页面协作规则。 - 定义默认前端技术栈、组件规则和页面协作规则。
- 将公司 Web 桌面端设计规范作为所有页面的 UI 基线。 - 将公司 Web 桌面端设计规范作为所有页面的 UI 基线。
- 定义后台页面的可复用组件使用规则。 - 定义后台页面的可复用组件使用规则。
- 定义使用 Codex + OpenSpec + Superpowers 的开发前工作流规则。 - 定义使用 OpenSpec + Superpowers 的开发前工作流规则。
- 记录阻塞业务实现的待确认需求问题。 - 记录阻塞业务实现的待确认需求问题。
- 本 change 仅覆盖前端与项目协作基线,不定义后端技术栈、数据库、队列、文件存储或接口契约。 - 本 change 仅覆盖前端与项目协作基线,不定义后端技术栈、数据库、队列、文件存储或接口契约。
...@@ -31,5 +31,5 @@ ...@@ -31,5 +31,5 @@
- 在 `architecture-spec/docs/` 下新增项目文档。 - 在 `architecture-spec/docs/` 下新增项目文档。
- 新增 OpenSpec 项目上下文和一个基线 change。 - 新增 OpenSpec 项目上下文和一个基线 change。
- 新增 `.superpowers-memory/` 文件,用于跨会话延续上下文。 - 新增 `.superpowers-memory/` 文件,用于跨会话延续上下文。
- 新增 `AGENTS.md`,用于约束本仓库中的 Codex 行为。 - 新增 `AGENTS.md`,用于约束本仓库中的 Agent 协作行为。
- 不新增任何业务实现代码。 - 不新增任何业务实现代码。
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
## 1. 文档 ## 1. 文档
- [x] 创建项目 README。 - [x] 创建项目 README。
- [x] 在 `AGENTS.md` 中创建 Codex 项目规则。 - [x] 在 `AGENTS.md` 中创建 Agent 项目规则。
- [x] 创建 OpenSpec 项目上下文。 - [x] 创建 OpenSpec 项目上下文。
- [x] 创建技术栈基线。 - [x] 创建技术栈基线。
- [x] 移除后端/API 强约定,保留前端页面协作基线。 - [x] 移除后端/API 强约定,保留前端页面协作基线。
......
...@@ -101,12 +101,24 @@ ...@@ -101,12 +101,24 @@
`Select` 与 `TreeSelect` SHALL 在选中后展示清晰选中态:触发器文字显示当前选中项,面板内对应项显示主色文字或浅主色背景,并暴露 `aria-selected`。树形节点展开后,父节点保持层级关系,叶子节点选中效果不得只依赖触发器文字。 `Select` 与 `TreeSelect` SHALL 在选中后展示清晰选中态:触发器文字显示当前选中项,面板内对应项显示主色文字或浅主色背景,并暴露 `aria-selected`。树形节点展开后,父节点保持层级关系,叶子节点选中效果不得只依赖触发器文字。
`Select` 在用户点击某个选项后 SHALL 立即关闭当前下拉面板,避免面板停留在页面上遮挡后续字段或操作区。该关闭行为对受控与非受控用法保持一致。
`Select` 的清空入口 SHALL 保持显式可配置。业务页面未开启 `allowClear` 时,组件不得在控件下方自动渲染独立 `清空` 按钮;当业务页面将“恢复默认值”设计为重新选择 `全部` 选项时,组件只负责展示当前值和下拉面板,不额外叠加第二套重置入口。
后台页面的左侧菜单 SHALL 通过共享导航组件承载,不允许在业务页面或布局文件中手写一级/二级菜单结构、父子级选中态和展开交互。导航组件需要支持后台常见的层级导航场景:一级菜单作为分组入口展示,二级菜单作为当前页面入口展示;当二级菜单选中时,其父级一级菜单同步展示轻度选中样式。
该导航组件应提供稳定的数据驱动接口,至少覆盖菜单项标识、标题、层级、图标槽位、链接目标、是否展开、当前选中项以及父级联动样式,保证后台框架只负责传入导航配置和路由状态,而不再手写具体 DOM 结构。
`TreeSelect` 的父节点 SHALL 支持点击展开与再次点击收起。父节点展开时展示子节点并将 `aria-expanded` 置为 `true`;再次点击同一父节点时隐藏子节点并将 `aria-expanded` 置为 `false`。 `TreeSelect` 的父节点 SHALL 支持点击展开与再次点击收起。父节点展开时展示子节点并将 `aria-expanded` 置为 `true`;再次点击同一父节点时隐藏子节点并将 `aria-expanded` 置为 `false`。
同一页面同时存在多个 `Select` 或 `TreeSelect` 时,选择类下拉框 SHALL 互斥打开。用户打开新的选择类下拉框时,当前页面中其他已打开的选择类下拉框 SHALL 自动关闭,避免多个下拉面板同时显示在界面上。 同一页面同时存在多个 `Select` 或 `TreeSelect` 时,选择类下拉框 SHALL 互斥打开。用户打开新的选择类下拉框时,当前页面中其他已打开的选择类下拉框 SHALL 自动关闭,避免多个下拉面板同时显示在界面上。
`Select` 与 `TreeSelect` 的下拉面板 SHALL 定位在触发输入框下方,并脱离普通文档流。下拉面板打开或关闭不应改变触发器宽度,也不应把后续表单项、按钮或 Demo 元素向下挤开。 `Select` 与 `TreeSelect` 的下拉面板 SHALL 定位在触发输入框下方,并脱离普通文档流。下拉面板打开或关闭不应改变触发器宽度,也不应把后续表单项、按钮或 Demo 元素向下挤开。
### 分页组件需要明确当前页和键盘跳转
`Pagination` SHALL 保持受控的 `current`、`pageSize` 和 `total` 语义。页码按钮中当前页 SHALL 通过 `aria-current="page"` 和可见选中样式同时表达状态,避免只具备语义标记而缺少视觉反馈。跳转输入框 SHALL 支持键盘提交,用户在输入目标页码后按 Enter 时,行为应与点击“跳转”按钮一致。
### 日期组件需符合桌面端面板结构 ### 日期组件需符合桌面端面板结构
`DatePicker` 与 `DateRangePicker` SHALL 使用桌面端日期面板结构:触发器显示日期值,面板包含月份标题、上一月/下一月箭头、星期标题、按周排列日期网格、选中日描边/主色状态、今天快捷入口和禁用日期状态。日期面板不应固定单月数据,需根据当前显示月份生成日期。 `DatePicker` 与 `DateRangePicker` SHALL 使用桌面端日期面板结构:触发器显示日期值,面板包含月份标题、上一月/下一月箭头、星期标题、按周排列日期网格、选中日描边/主色状态、今天快捷入口和禁用日期状态。日期面板不应固定单月数据,需根据当前显示月份生成日期。
...@@ -165,6 +177,18 @@ ...@@ -165,6 +177,18 @@
组件 Demo 路由 SHALL 在表格模块中展示至少一个空表格示例,确保人工验收时能直接看到表格内置空状态,而不是只看到独立 `Empty` 占位组件。 组件 Demo 路由 SHALL 在表格模块中展示至少一个空表格示例,确保人工验收时能直接看到表格内置空状态,而不是只看到独立 `Empty` 占位组件。
### 通用状态占位组件需要区分空态与失败态
组件库 SHALL 提供通用状态占位组件,命名为 `StatePlaceholder`。该组件用于页面内容区、表格内容区、抽屉内容区等需要表达“当前没有可展示内容或内容不可用”的位置,公开状态值覆盖 `empty`、`filtered-empty`、`error`、`forbidden` 和 `offline`。组件 SHALL 支持标题、说明、主操作、次操作、语义图标和可访问性角色;后续如业务页面需要更细的布局控制,可再扩展 `className`、`style` 或 CSS 变量。
`StatePlaceholder` SHALL 明确区分“请求成功但没有数据”和“请求失败导致数据未知”。空数据或筛选无结果可以使用“暂无数据”“未找到匹配结果”等文案;加载失败必须使用“加载失败”“数据加载失败,请重试”等失败文案,并提供可恢复操作,例如重试按钮。失败态 SHALL NOT 使用“暂无数据”作为主文案,避免误导用户认为接口已成功返回空结果。
列表页请求失败 SHALL 作为项目通用规则处理:任意后台列表、表格列表、卡片列表或资源列表在主数据请求失败且当前数据是否为空未知时,均使用 `StatePlaceholder state="error"` 承载内容区失败状态,并保留页面框架、筛选区、导航区和可恢复操作可用。列表请求失败 SHALL NOT 回退为 `Empty`、表格默认空态、“暂无数据”文案、`Alert` 或 `Message`。
`Empty` MAY 继续作为轻量空状态组件保留,用于请求成功后的简单无数据场景;`Table`、列表页和复杂页面 SHALL 通过 `StatePlaceholder` 统一承载可恢复失败、权限受限和筛选无结果等状态。`Alert` 和 `Message` 仍用于提示反馈,不替代内容区域的状态占位。
备选方案:继续使用 `Empty` 组件组合失败文案和重试按钮。该方案被拒绝作为长期方案,因为失败态、空态、筛选无结果和权限态语义不同,如果都复用 `Empty`,容易在业务页面中出现“加载失败却展示暂无数据”的误导性体验。
## Risks / Trade-offs ## Risks / Trade-offs
- [风险] 已上传设计规范中存在看起来像组件的 demo-only 代码。-> 缓解:本 change 只纳入独立组件文件;demo-only 组件后续单独确认。 - [风险] 已上传设计规范中存在看起来像组件的 demo-only 代码。-> 缓解:本 change 只纳入独立组件文件;demo-only 组件后续单独确认。
...@@ -182,6 +206,7 @@ ...@@ -182,6 +206,7 @@
- [风险] 日期弹窗打开后点击其他页面区域不关闭,用户需要重复点击触发器才能收起。-> 缓解:日期组件监听外部指针点击,触发器和弹窗内部点击保持正常交互,并补充外部点击关闭回归测试。 - [风险] 日期弹窗打开后点击其他页面区域不关闭,用户需要重复点击触发器才能收起。-> 缓解:日期组件监听外部指针点击,触发器和弹窗内部点击保持正常交互,并补充外部点击关闭回归测试。
- [风险] 日期弹窗固定宽度参与布局计算,导致日期输入框随弹窗宽度变宽。-> 缓解:日期组件使用独立定位容器,弹窗绝对定位,补充触发器宽度不受弹窗影响的回归测试。 - [风险] 日期弹窗固定宽度参与布局计算,导致日期输入框随弹窗宽度变宽。-> 缓解:日期组件使用独立定位容器,弹窗绝对定位,补充触发器宽度不受弹窗影响的回归测试。
- [风险] 表格空态只用纯文本时,业务页面需要额外手写空状态布局,导致视觉不一致。-> 缓解:`Table` 内置统一空状态插槽,并在 Demo 路由展示空表格验收样例。 - [风险] 表格空态只用纯文本时,业务页面需要额外手写空状态布局,导致视觉不一致。-> 缓解:`Table` 内置统一空状态插槽,并在 Demo 路由展示空表格验收样例。
- [风险] 业务页面把加载失败和暂无数据混为一类,导致用户误判数据真实为空。-> 缓解:新增 `StatePlaceholder` 语义状态规范,明确失败态必须展示失败文案和重试操作。
- [风险] `FormItem` 只展示必填星号但不执行校验,会让业务页面重复编写表单校验逻辑。-> 缓解:新增 `Form` 容器和 `FormItem rules`,由组件库统一处理基础必填校验与错误展示。 - [风险] `FormItem` 只展示必填星号但不执行校验,会让业务页面重复编写表单校验逻辑。-> 缓解:新增 `Form` 容器和 `FormItem rules`,由组件库统一处理基础必填校验与错误展示。
- [风险] 错误信息动态出现会造成表单布局跳动。-> 缓解:`FormItem` 为错误信息预留稳定区域,并通过布局样式保证错误文案不挤压后续元素。 - [风险] 错误信息动态出现会造成表单布局跳动。-> 缓解:`FormItem` 为错误信息预留稳定区域,并通过布局样式保证错误文案不挤压后续元素。
- [风险] `Upload` 容易被误解为真实上传 SDK。-> 缓解:组件库只提供 UI 形态和状态回调,不内置文件校验、接口传输、分片续传或预览弹层业务逻辑。 - [风险] `Upload` 容易被误解为真实上传 SDK。-> 缓解:组件库只提供 UI 形态和状态回调,不内置文件校验、接口传输、分片续传或预览弹层业务逻辑。
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
- 仅纳入可复用 UI 组件,不处理 `App.tsx` 中声明的 demo-only 组件。 - 仅纳入可复用 UI 组件,不处理 `App.tsx` 中声明的 demo-only 组件。
- 将基础输入类组件继续扩展到 `Textarea`,并为 `Input` 与 `Textarea` 补充简洁长度显示能力。 - 将基础输入类组件继续扩展到 `Textarea`,并为 `Input` 与 `Textarea` 补充简洁长度显示能力。
- 纳入 `Upload` 组件族,包含文件拖拽上传与图片/视频媒体墙两种规范形态。 - 纳入 `Upload` 组件族,包含文件拖拽上传与图片/视频媒体墙两种规范形态。
- 补充通用状态占位组件,用于统一表达空数据、筛选无结果、加载失败、权限受限等页面或列表内容状态,并明确加载失败不得误用“暂无数据”。
- 补充可复用后台导航组件能力,承载一级/二级菜单、父子级选中态和层级结构,避免业务页面手写侧边菜单。
- 补齐 `Pagination` 的当前页可见选中态,以及跳转输入框按 Enter 直接触发跳转的键盘交互。
- 确认一期组件库使用 React、TypeScript、CSS Variables 与 CSS Modules / 普通 CSS 实现;组件内部不依赖 Tailwind CSS。 - 确认一期组件库使用 React、TypeScript、CSS Variables 与 CSS Modules / 普通 CSS 实现;组件内部不依赖 Tailwind CSS。
- 允许后续业务页面使用 Tailwind CSS 做页面级布局,但组件必须自带完整规范样式,并通过受控 API、`className`、`style` 和 CSS 变量支持扩展。 - 允许后续业务页面使用 Tailwind CSS 做页面级布局,但组件必须自带完整规范样式,并通过受控 API、`className`、`style` 和 CSS 变量支持扩展。
- 在保持当前目录结构不调整的前提下,将组件能力按全局可复用资产设计,避免绑定单一业务项目。 - 在保持当前目录结构不调整的前提下,将组件能力按全局可复用资产设计,避免绑定单一业务项目。
...@@ -27,6 +30,6 @@ ...@@ -27,6 +30,6 @@
## Impact ## Impact
- 影响前端组件架构和后续业务页面实现规则。 - 影响前端组件架构和后续业务页面实现规则。
- 预计涉及目标前端应用或 UI 包、共享 UI 组件导出、样式 token、组件测试工具链,以及组件 Demo 页路由。 - 预计涉及目标前端应用或 UI 包、共享 UI 组件导出、样式 token、状态占位组件、组件测试工具链,以及组件 Demo 页路由。
- 技术选型影响一期组件源码组织、样式实现方式、组件测试方式和后续业务页面使用边界。 - 技术选型影响一期组件源码组织、样式实现方式、组件测试方式和后续业务页面使用边界。
- 不引入后端 API、数据存储或业务流程变更。 - 不引入后端 API、数据存储或业务流程变更。
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
### Requirement: 一期组件库范围 ### Requirement: 一期组件库范围
系统 SHALL 基于已上传设计规范中的独立组件文件,提供一期 Web 桌面端 UI 组件库。 系统 SHALL 基于已上传设计规范中的独立组件文件,提供一期 Web 桌面端 UI 组件库。
一期范围 SHALL 包含 `Button`、`Input`、`Textarea`、`SearchInput`、`TreeSelect`、`Table`、`Badge`、`Pagination`、`Alert`、`Message`、`Modal`、`FormItem`、`Card`、`DatePicker`、`DateRangePicker`、`Switch`、`Tag`、`Avatar`、`AvatarGroup`、`Tooltip`、`Popconfirm`、`Progress`、`Statistic`、`Timeline`、`Tabs`、`Drawer`、`Steps`、`Checkbox`、`Radio`、`Select`、`Empty`、`Skeleton`、`SkeletonAvatar`、`SkeletonParagraph`、`SkeletonButton`、`SkeletonInput`、`Collapse`、`ColorPicker`、`ColorInput` 和 `Upload`。 一期范围 SHALL 包含 `Button`、`Input`、`Textarea`、`SearchInput`、`TreeSelect`、`Table`、`Badge`、`Pagination`、`Alert`、`Message`、`Modal`、`FormItem`、`Card`、`DatePicker`、`DateRangePicker`、`Switch`、`Tag`、`Avatar`、`AvatarGroup`、`Tooltip`、`Popconfirm`、`Progress`、`Statistic`、`Timeline`、`Tabs`、`Drawer`、`Steps`、`Checkbox`、`Radio`、`Select`、`Empty`、`StatePlaceholder`、`Skeleton`、`SkeletonAvatar`、`SkeletonParagraph`、`SkeletonButton`、`SkeletonInput`、`Collapse`、`ColorPicker`、`ColorInput` 和 `Upload`。
#### Scenario: 实现一期组件 #### Scenario: 实现一期组件
- **WHEN** 实现组件库 - **WHEN** 实现组件库
...@@ -81,6 +81,40 @@ ...@@ -81,6 +81,40 @@
- **WHEN** 组件支持禁用、加载、选中、激活、空状态或错误状态 - **WHEN** 组件支持禁用、加载、选中、激活、空状态或错误状态
- **THEN** 这些状态使用项目 Web 桌面端设计 token,并与已上传设计规范保持视觉一致 - **THEN** 这些状态使用项目 Web 桌面端设计 token,并与已上传设计规范保持视觉一致
### Requirement: Select 支持后台筛选工作流
`Select` SHALL 支持后台筛选类表单的标准交互,包括选择后自动收起,以及按业务决定是否展示独立清空入口。
#### Scenario: 选择后关闭下拉面板
- **WHEN** 用户在 `Select` 下拉面板中选择任一可用选项
- **THEN** 组件更新当前值
- **AND** 当前下拉面板立即关闭
#### Scenario: 未开启清空能力
- **WHEN** 业务页面未为 `Select` 开启 `allowClear`
- **THEN** 组件不展示独立的 `清空` 按钮
#### Scenario: 开启清空能力
- **WHEN** 业务页面为 `Select` 开启 `allowClear` 且当前已有选中值
- **THEN** 组件展示独立的 `清空` 按钮
- **AND** 用户点击后将当前值重置为空
### Requirement: Navigation 支持后台层级菜单
共享导航组件 SHALL 支持后台左侧层级菜单工作流,统一承载一级/二级菜单结构、父子级选中态和数据驱动渲染。
#### Scenario: 渲染一级和二级菜单
- **WHEN** 后台框架传入包含父子层级的导航数据
- **THEN** 组件渲染一级菜单项及其对应的二级菜单项
- **AND** 业务页面无需手写导航层级 DOM 结构
#### Scenario: 二级菜单激活时联动父级样式
- **WHEN** 当前选中项是某个一级菜单下的二级菜单
- **THEN** 该二级菜单展示主选中样式
- **AND** 对应一级菜单同步展示轻度选中样式
#### Scenario: 通过配置驱动导航
- **WHEN** 后台框架传入菜单项标识、标题、层级、链接和当前选中项
- **THEN** 组件根据配置渲染导航,而不是要求业务页面手写交互和样式逻辑
### Requirement: 组件实现采用测试先行 ### Requirement: 组件实现采用测试先行
组件实现 SHALL 采用 TDD 方式推进:在实现或迁移组件前,先为组件的公开行为、关键状态和可访问交互编写测试或可执行验收样例。 组件实现 SHALL 采用 TDD 方式推进:在实现或迁移组件前,先为组件的公开行为、关键状态和可访问交互编写测试或可执行验收样例。
...@@ -148,6 +182,61 @@ ...@@ -148,6 +182,61 @@
- **WHEN** 表格行存在可用操作 - **WHEN** 表格行存在可用操作
- **THEN** 表格可以在操作列中渲染紧凑操作控件 - **THEN** 表格可以在操作列中渲染紧凑操作控件
### Requirement: Pagination 支持当前页反馈和键盘跳转
分页组件 SHALL 在后台列表场景中明确展示当前页选中态,并支持跳转输入框的 Enter 键提交行为。
#### Scenario: 展示当前页
- **WHEN** 分页渲染当前页码
- **THEN** 当前页按钮 SHALL 展示可见选中态
- **AND** 当前页按钮 SHALL 暴露 `aria-current="page"`
#### Scenario: 按回车跳转
- **WHEN** 用户在跳转输入框输入目标页码并按下 Enter
- **THEN** 分页组件 SHALL 触发与点击“跳转”按钮一致的页码跳转行为
### Requirement: StatePlaceholder 统一内容状态占位
`StatePlaceholder` SHALL 作为组件库统一内容状态占位组件,覆盖空数据、筛选无结果、加载失败、权限受限和离线不可用等状态。
`StatePlaceholder` 的公开状态值 SHALL 使用 `empty`、`filtered-empty`、`error`、`forbidden` 和 `offline`。
项目内所有后台列表、表格列表、卡片列表或资源列表 SHALL 在主数据请求失败且当前数据是否为空未知时使用 `StatePlaceholder` 的 `error` 语义承载内容区失败状态。
#### Scenario: 展示空数据
- **WHEN** 请求成功且当前内容没有任何数据
- **THEN** `StatePlaceholder` 使用空状态语义展示“暂无数据”或业务自定义空态文案
#### Scenario: 展示筛选无结果
- **WHEN** 请求成功但当前搜索或筛选条件没有匹配结果
- **THEN** `StatePlaceholder` 使用 `filtered-empty` 语义展示“未找到匹配结果”或业务自定义文案,并允许业务侧提供清空筛选操作
#### Scenario: 展示加载失败
- **WHEN** 内容数据加载失败且当前数据是否为空未知
- **THEN** `StatePlaceholder` 使用 `error` 语义展示加载失败文案
- **AND** `StatePlaceholder` SHALL NOT 使用“暂无数据”作为失败态主文案
- **AND** `StatePlaceholder` 支持业务侧提供重试操作
#### Scenario: 列表请求失败
- **WHEN** 任意后台列表、表格列表、卡片列表或资源列表的主数据请求失败
- **THEN** 页面使用 `StatePlaceholder` 的 `error` 语义展示列表失败状态
- **AND** 页面保留框架、筛选区、导航区和重试操作可用
- **AND** 页面 SHALL NOT 使用 `Empty`、表格默认空态、“暂无数据”文案、`Alert` 或 `Message` 替代列表内容区失败状态
#### Scenario: 展示权限受限
- **WHEN** 当前账号没有访问内容的权限
- **THEN** `StatePlaceholder` 使用 `forbidden` 语义展示权限受限文案
#### Scenario: 展示离线不可用
- **WHEN** 当前内容因网络不可用无法加载
- **THEN** `StatePlaceholder` 使用 `offline` 语义展示网络不可用文案,并允许业务侧提供重试操作
#### Scenario: 嵌入表格内容区域
- **WHEN** 表格、列表或页面内容区需要展示可恢复失败状态
- **THEN** 业务页面可以在内容区域使用 `StatePlaceholder`,并保持页面框架、筛选区和导航区可用
#### Scenario: 区分反馈组件
- **WHEN** 页面需要表达内容区不可用或数据未知
- **THEN** 页面使用 `StatePlaceholder` 展示内容状态,而不是只使用 `Message` 或 `Alert` 替代内容占位
### Requirement: 反馈和浮层组件支持受控工作流 ### Requirement: 反馈和浮层组件支持受控工作流
反馈和浮层组件 SHALL 支持后台常见受控使用方式,包括提示、弹窗、抽屉、二次确认、悬浮说明,以及适用场景下的浮层内容。 反馈和浮层组件 SHALL 支持后台常见受控使用方式,包括提示、弹窗、抽屉、二次确认、悬浮说明,以及适用场景下的浮层内容。
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
- [x] 3.9 根据人工验收修正选择类下拉互斥:同一页面中 `Select` 与 `TreeSelect` 只能同时打开一个下拉面板,打开新的选择器时自动关闭旧面板,并补充回归测试。 - [x] 3.9 根据人工验收修正选择类下拉互斥:同一页面中 `Select` 与 `TreeSelect` 只能同时打开一个下拉面板,打开新的选择器时自动关闭旧面板,并补充回归测试。
- [x] 3.10 根据人工验收修正选择类下拉定位:`Select` 与 `TreeSelect` 下拉面板定位在触发器下方并脱离文档流,不挤压下面元素,补充样式回归测试。 - [x] 3.10 根据人工验收修正选择类下拉定位:`Select` 与 `TreeSelect` 下拉面板定位在触发器下方并脱离文档流,不挤压下面元素,补充样式回归测试。
- [x] 3.11 根据人工验收修正 `TreeSelect` 父节点收起交互:再次点击已展开父节点时收起子节点并更新箭头与 `aria-expanded`,补充回归测试。 - [x] 3.11 根据人工验收修正 `TreeSelect` 父节点收起交互:再次点击已展开父节点时收起子节点并更新箭头与 `aria-expanded`,补充回归测试。
- [ ] 3.12 根据人工验收补齐 `Select` 后台筛选交互:选中选项后自动收起下拉面板,并确认 `allowClear` 关闭时不展示独立 `清空` 按钮,补充回归测试。
## 4. 日期组件 ## 4. 日期组件
...@@ -57,6 +58,7 @@ ...@@ -57,6 +58,7 @@
- [x] 5.3 实现 `Table` 状态逻辑:完成 loading、empty、排序、筛选、行选择和操作列逻辑,并补齐单元测试、审核注释。 - [x] 5.3 实现 `Table` 状态逻辑:完成 loading、empty、排序、筛选、行选择和操作列逻辑,并补齐单元测试、审核注释。
- [x] 5.4 实现 `Table` 样式:完成表头、行 hover、选择列、操作列、loading 蒙层和空状态样式,并补齐渲染测试和审核注释。 - [x] 5.4 实现 `Table` 样式:完成表头、行 hover、选择列、操作列、loading 蒙层和空状态样式,并补齐渲染测试和审核注释。
- [x] 5.5 实现 `Pagination`:包含接口定义、页码/每页条数/总数/跳页逻辑、分页样式、单元测试、审核注释。 - [x] 5.5 实现 `Pagination`:包含接口定义、页码/每页条数/总数/跳页逻辑、分页样式、单元测试、审核注释。
- [ ] 5.5a 根据人工验收补齐 `Pagination` 当前页选中态与键盘跳转:当前页按钮展示明显选中态,跳转输入框按 Enter 触发页码跳转,并补充回归测试和审核注释。
- [x] 5.6 验证 `Table` 与 `Pagination`、`Tag`、`Badge`、`Button`、`Popconfirm` 的组合示例和审核注释。 - [x] 5.6 验证 `Table` 与 `Pagination`、`Tag`、`Badge`、`Button`、`Popconfirm` 的组合示例和审核注释。
- [x] 5.7 根据人工验收增强 `Table` 空状态:保留 `emptyText` 兼容,新增可配置 `empty` 插槽,默认复用统一空状态视觉,并在 Demo 表格模块展示空表格样例,补充回归测试和审核注释。 - [x] 5.7 根据人工验收增强 `Table` 空状态:保留 `emptyText` 兼容,新增可配置 `empty` 插槽,默认复用统一空状态视觉,并在 Demo 表格模块展示空表格样例,补充回归测试和审核注释。
...@@ -100,6 +102,9 @@ ...@@ -100,6 +102,9 @@
- [x] 8.4 实现 `Skeleton` 基础组件:包含接口定义、形状/尺寸/动画逻辑、骨架样式、单元测试、审核注释。 - [x] 8.4 实现 `Skeleton` 基础组件:包含接口定义、形状/尺寸/动画逻辑、骨架样式、单元测试、审核注释。
- [x] 8.5 实现 `SkeletonAvatar`、`SkeletonParagraph`、`SkeletonButton` 和 `SkeletonInput`:包含接口定义、组合逻辑、形态样式、单元测试、审核注释。 - [x] 8.5 实现 `SkeletonAvatar`、`SkeletonParagraph`、`SkeletonButton` 和 `SkeletonInput`:包含接口定义、组合逻辑、形态样式、单元测试、审核注释。
- [x] 8.6 根据人工验收统一 `Collapse` 等展开箭头:与选择类组件复用同一箭头图标资产,补充样式回归测试。 - [x] 8.6 根据人工验收统一 `Collapse` 等展开箭头:与选择类组件复用同一箭头图标资产,补充样式回归测试。
- [x] 8.7 实现 `StatePlaceholder` 基础接口与请求失败态:支持 `error` 状态、标题、说明、主操作、次操作、图标、可访问性角色、单元测试和审核注释,并确保失败态不使用“暂无数据”文案。
- [ ] 8.8 补齐 `StatePlaceholder` 其他语义状态验收:覆盖 `empty`、`filtered-empty`、`forbidden` 和 `offline` 的专项测试,确认默认标题、说明、角色和样式语义符合规范。
- [ ] 8.9 扩展共享 `Navigation` 组件以支持后台侧边导航:覆盖一级/二级菜单、父子级选中态、数据驱动渲染,补充单元测试、Demo 示例和审核注释。
## 9. 颜色能力组件 ## 9. 颜色能力组件
...@@ -119,6 +124,8 @@ ...@@ -119,6 +124,8 @@
- [x] 10.7 根据人工验收完善 `Button` Demo:在基础交互模块展示全部按钮类型、尺寸、loading、disabled 和图标场景,补充 Demo 回归测试。 - [x] 10.7 根据人工验收完善 `Button` Demo:在基础交互模块展示全部按钮类型、尺寸、loading、disabled 和图标场景,补充 Demo 回归测试。
- [x] 10.8 根据人工确认新增 `Upload` Demo:展示文件拖拽上传完成、上传中、失败状态,以及图片/视频媒体墙,补充 Demo 回归测试。 - [x] 10.8 根据人工确认新增 `Upload` Demo:展示文件拖拽上传完成、上传中、失败状态,以及图片/视频媒体墙,补充 Demo 回归测试。
- [x] 10.9 根据人工确认补齐基础输入 Demo:展示 `Input` 与 `Textarea` 的简洁长度显示配置,补充 Demo 回归测试。 - [x] 10.9 根据人工确认补齐基础输入 Demo:展示 `Input` 与 `Textarea` 的简洁长度显示配置,补充 Demo 回归测试。
- [x] 10.10 补齐 `StatePlaceholder` 请求失败 Demo:展示加载失败状态,并覆盖加载失败提供重试操作、不展示“暂无数据”的验收样例。
- [ ] 10.11 补齐 `StatePlaceholder` 全状态 Demo:展示空数据、筛选无结果、权限受限和离线不可用状态,便于人工验收全部状态占位视觉。
## 10A. 上传组件 ## 10A. 上传组件
...@@ -133,3 +140,4 @@ ...@@ -133,3 +140,4 @@
- [x] 11.3 如果目标项目存在额外测试命令,运行相关自动化测试。 - [x] 11.3 如果目标项目存在额外测试命令,运行相关自动化测试。
- [ ] 11.4 启动前端应用,并在浏览器中验证独立组件 Demo 路由的布局、交互和设计一致性。 - [ ] 11.4 启动前端应用,并在浏览器中验证独立组件 Demo 路由的布局、交互和设计一致性。
- [ ] 11.5 确认 Demo 路由展示全部一期组件,并纳入 `Upload`,同时排除其他 `App.tsx` 中的 demo-only 组件。 - [ ] 11.5 确认 Demo 路由展示全部一期组件,并纳入 `Upload`,同时排除其他 `App.tsx` 中的 demo-only 组件。
- [x] 11.6 后续验证 `StatePlaceholder` 可在表格或列表内容区域承载失败态,并保持页面框架、筛选区和导航区可用。
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
## 目标 ## 目标
建设一个可承载多个项目的独立 monorepo 工作区。当前优先沉淀前端规则、公司 Web 桌面端组件规范和 Codex + OpenSpec + Superpowers 工作流。首个业务项目是 AI 大模型后台管理平台,用于支持 Agent 管理、Agent 群管理、官网展示配置及相关运营工作流。 建设一个可承载多个项目的独立 monorepo 工作区。当前优先沉淀前端规则、公司 Web 桌面端组件规范和 OpenSpec + Superpowers 工作流。首个业务项目是 AI 大模型后台管理平台,用于支持 Agent 管理、Agent 群管理、官网展示配置及相关运营工作流。
## 流程 ## 流程
......
...@@ -20,15 +20,10 @@ ...@@ -20,15 +20,10 @@
需求沉淀: 需求沉淀:
- [前端范围与确认决策](./frontend-scope-and-decisions.md)
- [后台登录页需求沉淀](./requirements-admin-login.md) - [后台登录页需求沉淀](./requirements-admin-login.md)
- [Agent 管理需求沉淀](./requirements-agent-management.md) - [Agent 管理需求沉淀](./requirements-agent-management.md)
- [Agent 群管理需求沉淀](./requirements-agent-group-management.md) - [Agent 群管理需求沉淀](./requirements-agent-group-management.md)
- [官网配置与 H5 展示需求沉淀](./requirements-official-site-config.md) - [官网配置与 H5 展示需求沉淀](./requirements-official-site-config.md)
- [官网 H5 前端需求交互确认内容](./frontend-h5-official-site-interaction-confirmation.md)
- [PC 管理后台整体框架与布局确认内容](./frontend-pc-admin-framework-layout-confirmation.md)
- [后端接口文档对齐待确认事项](./backend-api-alignment-open-questions.md)
- [前端待确认事项](./frontend-open-questions.md)
当前阶段只做需求确认、前端规范落地和 OpenSpec 草案准备。确认完成后,再为具体功能创建对应端的 OpenSpec change:管理后台前端放 `web/openspec/changes/`,官网 H5 放 `single-page/openspec/changes/`。 当前阶段只做需求确认、前端规范落地和 OpenSpec 草案准备。确认完成后,再为具体功能创建对应端的 OpenSpec change:管理后台前端放 `web/openspec/changes/`,官网 H5 放 `single-page/openspec/changes/`。
......
# 后端接口文档对齐待确认事项
更新时间:2026-05-18
## 背景
后端已提供接口文档:
- 文档名称:后端接口清单文档(2026 年 5 月 SAAS 版本)
- 飞书文档:`AJRWdzsxLoWhsyxWydnckcB1nhf`
- 已读取版本:revision 9
本文档用于沉淀前端需求文档与后端接口文档之间仍需再次确认的内容。
## 对齐口径
已确认的对齐原则:
- 接口路径风格、响应格式、分页格式、字段名称、字段类型以后端接口文档为主。
- 字段长度、必填规则、页面功能、业务规则、联动规则、本期范围以需求文档为主。
因此,以下内容不作为问题处理:
| 类型 | 后端口径 |
|-|-|
| 接口前缀 | `/api/v1` |
| 字段命名 | snake_case |
| 成功响应 | `code: 200` |
| 分页参数 | `page`、`page_size` |
| 状态枚举 | `enable`、`disable` |
后续前端契约更新时,可以按后端格式重写字段名和接口路径,但业务规则仍需回到 PRD 和已确认需求。
## 不需要后端补充的接口
### 1. 管理后台登录接口
需求已确认:本期管理后台登录页由前端写死账号密码并在本地校验。
| 字段 | 值 |
|-|-|
| 账号 | `admin` |
| 密码 | `123456` |
因此当前不要求后端新增登录接口、用户信息接口或鉴权校验接口。后端接口文档中的 JWT 设计可保留为后续真实鉴权方案,前端本期不依赖它完成登录页。
## 后端已补充的官网配置接口
### 1. 官网配置接口
后端 revision 9 已补充官网配置后台接口。
已补充:
| 页面/能力 | 建议接口能力 |
|-|-|
| 官网配置列表 | `GET /api/v1/official-site/tabs` |
| 新增岗位展示配置 | `POST /api/v1/official-site/tabs` |
| 编辑岗位展示配置 | `PUT /api/v1/official-site/tabs/{tab_id}` |
| Tab 删除 | `DELETE /api/v1/official-site/tabs/{tab_id}` |
| Tab 上架/下架 | `PUT /api/v1/official-site/tabs/{tab_id}/status` |
| Tab 关联渠道活码 | `GET /api/v1/official-site/tabs/qrcodes/available` |
已确认口径:
1. 官网 Tab 使用 `position_code` 作为岗位关联字段。
2. 官网 Tab 删除接口由后端清理该 Tab 下所有 Agent 展示配置。
3. Tab 上架/下架不影响关联渠道活码状态和可用性。
### 2. 官网 Agent 展示配置接口
后端 revision 9 已补充官网 Tab 下的 Agent 卡片配置接口。
已补充:
| 页面/能力 | 建议接口能力 |
|-|-|
| 配置 Agent 页面 | `GET /api/v1/official-site/tabs/{tab_id}/agents/available` |
| 保存 Agent 展示配置 | `POST /api/v1/official-site/tabs/{tab_id}/agents/{agent_id}/config` |
| 已配置 Agent 列表 | `GET /api/v1/official-site/tabs/{tab_id}/agents/configured` |
| 删除 Agent 展示配置 | `DELETE /api/v1/official-site/tabs/{tab_id}/agents/{agent_id}/config` |
| Agent 展示素材上传 | `POST /api/v1/official-site/upload`,`usage_type = agent_media` |
需求规则:
- 可配置 Agent 来源为:所选渠道活码关联 Agent -> 排除管家 Agent -> 筛选已上架 Agent。
- 前端不允许手动新增或删除 Agent。
- Agent 删除后,后端清理对应展示配置。
- 展示素材支持 GIF/MP4,最大 20MB,推荐 1:1。
- H5 进入视口自动播放,MP4 循环播放,不静音,无封面,加载失败展示占位图。
已确认口径:
1. 后端返回 `media_url`、`media_type`、`media_size` 等展示配置字段;上传接口返回 `file_url`、`file_type`、`file_size`、宽高和 `cdn_url`。
2. 素材上传复用统一官网上传接口 `POST /api/v1/official-site/upload`。
3. Agent 上架后自动恢复原展示配置。
### 3. 方法论配置接口
后端 revision 9 已补充官网方法论展示配置接口。
已补充:
| 页面/能力 | 建议接口能力 |
|-|-|
| 方法论展示配置页 | `GET /api/v1/official-site/methodology` |
| 保存方法论配置 | `POST /api/v1/official-site/methodology` |
| 方法论图片上传 | `POST /api/v1/official-site/upload`,`usage_type = methodology_icon` / `methodology_image` |
需求规则:
- 方法论为全局模块,不绑定具体岗位。
- 固定展示在岗位 Tab 内容区下方,不随 Tab 切换变化。
- 主标题最多 30 字。
- 副标题最多 100 字。
- 步骤名称最多 20 字。
- 内容图支持 PNG/JPG,最大 10MB。
### 4. H5 首页聚合接口
后端 revision 9 已补充官网移动端 H5 聚合接口。
已补充:
| H5 区域 | 需要数据 |
|-|-|
| Banner | 标题、辅助文案、背景图 |
| 岗位 Tab | 仅展示中的 Tab,包含排序 |
| 渠道活码区域 | 当前岗位对应活码、二维码图片 URL、状态 |
| Agent 卡片 | 当前 Tab 下展示中的 Agent 卡片 |
| 方法论模块 | 全局方法论配置 |
需求规则:
- H5 Banner 标题使用「岗位Agent管理后台」。
- Tab 切换只切换渠道活码区域和 Agent 卡片网格。
- 方法论模块不随 Tab 切换。
- 二维码图片由后端提供 URL,前端不生成二维码。
- H5 不采集任何埋点。
待确认问题:
1. H5 首页聚合接口示例中的 `qrcode_status`、Agent 卡片 `status` 是否统一改为通用 `enable` / `disable` 枚举。
## 需要后端补充或再次确认的接口
### 5. 岗位标签删除前级联检查接口缺失
后端接口文档当前只说明删除岗位标签时检查是否被 Agent 引用,需求要求增加完整级联检查。
需要补充或调整:
| 检查项 | 需求处理 |
|-|-|
| 已被 Agent 使用 | 提示确认,确认后这些 Agent 失去该标签 |
| 已被渠道活码使用 | 不可删除,提示先删除关联渠道活码 |
| 已被官网 Tab 使用 | 不可删除,提示先删除关联官网 Tab 配置 |
| 引用全部解除 | 方可删除 |
待确认问题:
1. 是否提供独立删除前检查接口。
2. 删除接口 409 时是否返回 Agent、渠道活码、官网 Tab 的引用数量和提示文案。
3. 确认后解除 Agent 标签关联的参数如何表达。
### 6. 渠道活码同岗位占用检查接口缺失
需求要求同岗位仅允许一个渠道活码,且启用和停用状态均占名额。
需要补充或调整:
- 创建渠道活码前,前端需要知道某岗位是否已有活码。
- 若已有活码,新增置灰,提示「该岗位已有渠道活码,请编辑原活码」。
- 后端创建接口也需要按岗位维度做唯一性校验。
待确认问题:
1. 是否提供岗位占用检查接口。
2. 如果不提供检查接口,创建接口返回 409 时是否包含已存在活码 ID、名称和状态。
### 7. 渠道活码停用与官网 Tab 关联校验缺失
需求要求:
- 活码被「展示中」官网 Tab 关联时,禁止停用。
- 活码只被「已下架」官网 Tab 关联时,不阻止停用。
- 禁止停用时,前端提示「请先在官网配置中解除关联」。
后端停用活码接口需要补充该业务校验和明确错误返回。
待确认问题:
1. 停用失败时错误码是否使用 409。
2. 返回信息是否包含阻止停用的官网 Tab 名称或 ID。
## 需要按需求修正的业务规则
### 1. 渠道活码唯一维度
后端接口文档当前体现为员工 + 岗位维度:
- 创建活码参数包含 `employee_id`、`employee_name`、`wechat_user_id`。
- 异常处理为「员工已存在同岗位活码」。
需求口径:
- 同岗位仅允许一个渠道活码。
- 启用和停用状态均计为已创建。
- 同岗位已有活码时只能编辑原活码。
待确认结论:
- 字段名称和类型可沿用后端文档,但唯一性规则需要按岗位维度收敛。
### 2. 渠道活码关联 Agent 不应由前端提交
后端接口文档当前创建/编辑渠道活码时传 `agent_ids`。
需求口径:
- 删除「群模板」概念。
- 建群时实时查询该岗位所有已上架 Agent + 管家 Agent。
- 活码页面可以展示关联 Agent,但前端不维护固定 Agent 清单。
待确认结论:
- `agent_ids` 可以作为后端返回的展示字段。
- 创建/编辑渠道活码时,前端不应提交 `agent_ids`。
### 3. Agent 删除规则
后端接口文档当前删除 Agent 时会检查会话、路由等引用,仍被引用时返回 409。
需求口径:
- 管家 Agent 不允许删除。
- 非管家 Agent 可直接删除。
- 删除后系统执行以下操作:
- 该 Agent 的企微员工从所有已关联群中退出。
- 官网展示配置将被清理。
- 渠道活码 Agent 列表中不再出现。
- 关联的岗位标签不受影响。
待确认结论:
- 后端不应因会话或路由引用阻止非管家 Agent 删除。
- 如有异步清理任务,前端只展示删除成功或失败结果,不处理运行时细节。
### 4. 管家 Agent 特殊规则
后端接口文档暂未体现管家 Agent 特殊规则。
需求口径:
- 管家 Agent 固定存在。
- 管家 Agent 固定上架。
- 管家 Agent 不允许删除。
- 管家 Agent 不允许停用。
- 管家 Agent 在 Agent 列表置顶。
- 管家 Agent 不参与官网 Agent 展示配置。
- 渠道活码或建群时需要包含管家 Agent。
待确认问题:
1. 后端是否返回 `is_steward` 字段,或约定固定 `code` 识别管家 Agent。
2. 管家 Agent 的岗位是否固定返回「系统调度」。
### 5. Agent 状态联动
需求口径:
- Agent 停用后,官网同步隐藏该 Agent,保留展示配置。
- Agent 上架后,官网可再次选择和展示该 Agent,原展示配置自动恢复。
- 已建群不由前端处理。
后端接口文档当前主要描述通知路由层和处理进行中会话,未体现官网展示配置联动。
待确认问题:
1. Agent 状态变化后,官网展示配置是否由后端自动保留和恢复。
2. 查询官网 Agent 展示配置时,已停用 Agent 是否返回为不可配置状态,还是直接不返回。
## 字段约束按需求口径执行
字段名称和类型以后端为准,但以下长度和必填规则按需求文档执行。其中 Agent `name`、`description` 已确认采用前端草案规则。
| 模块 | 字段 | 后端文档 | 需求口径 |
|-|-|-|-|
| Agent | `name` | 最多 20 字 | 已确认:最多 50 字 |
| Agent | `description` | 最多 100 字 | 已确认:最多 500 字 |
| Agent | `skill_codes` | 至少 1 个 | 非管家 Agent 至少 1 个,管家 Agent 可选 |
| 渠道活码 | `remark` | 备注字段 | 活码描述最多 200 字 |
| 渠道活码 | 自动欢迎语 | 未体现 | 最多 500 字 |
| 官网 Agent 展示 | 话术标题 | 未体现 | 最多 20 字 |
| 官网 Agent 展示 | 话术正文 | 未体现 | 最多 100 字 |
| 官网 Agent 展示 | 展示素材 | 未体现 | GIF/MP4,最大 20MB |
| 方法论 | 主标题 | 未体现 | 最多 30 字 |
| 方法论 | 副标题 | 未体现 | 最多 100 字 |
| 方法论 | 步骤名称 | 未体现 | 最多 20 字 |
| 方法论 | 内容图 | 未体现 | PNG/JPG,最大 10MB |
## 后端文档多出但需求未确认的前端范围
以下接口在后端文档中标记为后台管理接口,但当前需求沉淀中未明确作为本期前端范围。
需要产品确认是否进入本期:
| 接口/能力 | 后端接口 |
|-|-|
| 对话日志页 | `GET /api/v1/logs/conversations` |
| 数据统计看板 | `GET /api/v1/analytics/statistics` |
| 历史数据迁移 | `POST /api/v1/migration/sessions` |
| 群聊管理列表 | `GET /api/v1/agent-group/group/list` |
| 活码批量导出 | `POST /api/v1/agent-group/qrcode/export` |
| 活码批量状态变更 | `POST /api/v1/agent-group/qrcode/batch-status` |
| 活码使用统计 | `GET /api/v1/agent-group/qrcode/{qrcode_id}/statistics` |
| 岗位维度活码统计 | `GET /api/v1/agent-group/position/{position_code}/statistics` |
| 岗位员工列表 | `GET /api/v1/agent-group/position/{position_code}/employees` |
| 员工活码列表 | `GET /api/v1/agent-group/employee/{employee_id}/qrcodes` |
| 页面 PV 埋点上报 | `POST /api/v1/agent-group/analytics/page-view` |
当前建议:
- 若产品未确认这些页面,不纳入本期前端 OpenSpec。
- 若仅为后端预留能力,前端需求文档中不展开页面设计。
## 前端不需要关注的后端接口
后端接口文档中以下能力属于后端或企微服务范围,前端不实现、不联调页面:
- 会话创建、更新、归档。
- 上下文继承。
- 管家 Agent 统一消息入口。
- 文件上传与解析。
- 用户扫码事件回调。
- 创建专属群聊。
- Agent 自动入群。
- 客户退群事件回调。
- 扫码事件埋点、入群成功事件埋点。
前端只在后台页面消费后端返回的配置、状态和错误信息。
## 建议确认顺序
1. 先确认 H5 首页聚合接口示例中的 `qrcode_status`、Agent 卡片 `status` 是否统一使用 `enable` / `disable`。
2. 再确认渠道活码的唯一维度是否从员工 + 岗位调整为岗位维度。
3. 确认渠道活码创建/编辑是否移除前端提交 `agent_ids`。
4. 确认 Agent 删除、管家 Agent、岗位标签删除、活码停用这些业务规则按需求文档调整。
5. 确认后端文档中多出的统计、日志、群聊、导出、批量操作接口是否进入本期前端范围。
# 前端待确认事项
更新时间:2026-05-15
当前 PRD 已基本完成需求边界收敛。以下为进入 OpenSpec 前建议再确认的前端细节,不阻塞需求沉淀。
## 页面与交互
1. 删除 Agent、删除官网 Tab、停用活码等高影响操作是否统一使用二次确认 Modal。
2. 文件上传是否已有统一组件,包括进度、失败重试、格式校验和大小校验。
已确认:后台管理页本期需要登录页,由前端写死账号密码校验,不调用接口;权限仍按管理员单角色处理。
已确认:登录成功后的默认落点为 `Agent管理 > Agent列表`;如果未登录访问业务页面,登录成功后优先回到原访问路径。
已确认:Skill 说明使用抽屉展示 Markdown,支持基础 Markdown 渲染、代码块样式、抽屉内部滚动、加载态、失败态和空态;本期不要求目录和代码块复制。
## H5 展示
1. H5 Banner 的汽车飞驰背景图由设计提供、运营上传,还是前端内置静态资源。
2. 渠道活码图片加载失败时,前台 H5 展示的占位图和文案是否需要设计确认。
3. MP4 不静音自动播放在移动端浏览器可能受系统策略限制,是否接受降级为用户手势后播放。
4. H5 无埋点已确认,但是否需要基础错误日志或资源加载失败日志仍可由研发另行决定。
## 联调契约
1. API 契约由研发独立维护。前端 OpenSpec 前仍需要拿到字段、枚举、分页、错误码、上传返回值和 mock 数据。
2. 后端运行时异常流不由前端实现,但如果管理后台需要展示异常状态,需要后端提供状态字段和文案。
3. 渠道活码图片 URL 的过期策略、鉴权方式、跨域策略需要在联调契约中明确。
# 前端范围与确认决策
更新时间:2026-05-15
## 文档来源
| 模块 | 飞书文档 | 已读取版本 |
|-|-|-|
| Agent 管理 | `PyimdH3hioAaY4xL8GTcOcoTnUf` | revision 60 |
| Agent 群管理 | `OZR8dSxJEox0eBxnV2fcmTWyn0f` | revision 32 |
| 官网配置 | `FYN4d3Nbro8a0XxnBCecLK5mn5d` | revision 24 |
## 产品定位
产品后台名称统一为「岗位Agent管理后台」。
PRD 标题、H5 Banner、项目文件命名和页面展示文案均以「岗位Agent管理后台」为准,不再使用「智享车生活」作为后台产品名称。
## 前端边界
当前需求沉淀只覆盖前端范围:
- `web/`:岗位Agent管理后台,包含前端本地登录页、Agent 管理、Agent 群管理、官网配置后台。
- `single-page/`:官网移动端 H5 展示,包含岗位 Tab、渠道活码展示、Agent 卡片、方法论模块。
- 前端契约草案:页面需要的字段、枚举、状态、校验、空态、错误态、loading 态和 mock 数据。
## 后端边界
以下内容归属后端范围,本前端需求沉淀不展开实现设计:
- 管家 Agent 运行时路由、记忆、多模态处理。
- 嘀加企微管家 API 对接、企微建群、拉人、解散群、异常推送。
- 后端接口实现、数据表、任务、队列、错误码实现。
前端文档中只把这些能力作为「依赖后端返回的数据或状态」描述。
## 已确认决策
1. 本期交付范围为管理后台前端和官网移动端 H5 展示。管家 Agent 路由、记忆、多模态处理归属后端运行时能力,前端只展示和配置相关界面。
2. 权限统一收窄为管理员。前端页面按管理员单角色设计,不做多角色差异化。
3. 非管家 Agent 可直接删除。删除弹窗文案使用「删除后系统将执行以下操作」,展示 4 条执行项。
4. 群模板概念删除。后续建群均按建群当时的岗位与 Agent 状态实时查询企微员工清单。
5. 同岗位仅允许创建一个渠道活码,启用和停用状态均占用唯一名额。同岗位已有活码时只能编辑原活码。
6. 渠道活码停用仅受「展示中的」官网 Tab 阻止。已下架 Tab 仍可关联活码,但不阻止活码停用。
7. 官网 Tab 可删除。删除后清理该 Tab 下 Agent 展示配置,不影响 Agent 原始数据和渠道活码。
8. 二维码来源为嘀加 API 返回后由后台转存或提供访问 URL,H5 前端只负责渲染图片,不在前端生成二维码。
9. Agent 展示素材移动端约束:GIF/MP4、最大 20MB、推荐 1:1、进入视口自动播放、MP4 循环播放、不静音、不需要封面、加载失败展示占位图。
10. 异常流第一版不重试,由后端记录并推送运维人工处理。前端只按后端状态展示。
11. API 契约不在 PRD 定义,由研发独立维护;前端阶段先沉淀页面字段和 mock 数据。
12. C 端 H5 前台不采集任何埋点。后台管理页面按 PRD 采集页面打开及少量指定操作事件。
13. 管理后台登录页本期由前端写死账号密码校验,不调用后端接口。固定账号为 `admin`,固定密码为 `123456`。
## 后续文档原则
- 不进入业务代码实现。
- 不创建或维护 `backend/` 设计文档。
- 不进入 OpenSpec,直到需求确认完成。
- 如果需要表达联调边界,先写前端需要的字段、枚举、页面状态和 mock 示例。
...@@ -4,13 +4,21 @@ ...@@ -4,13 +4,21 @@
## 文档定位 ## 文档定位
本文档记录「广联岗位Agent」官网 H5 前台展示页的前端需求与交互确认内容,便于后续 `single-page/` 项目开发对齐。 本文档记录「广联Agent」官网 H5 前台展示页的前端需求与交互确认内容,便于后续 `single-page/` 项目开发对齐。
当前阶段只确认 H5 端展示和交互规则。PC 端展示规范后续补充。 当前阶段只确认 H5 端展示和交互规则。PC 端展示规范后续补充。
## 项目范围确认
- `workspace/agent-admin/single-page` 负责官网移动端 H5。
- `single-page/` 产品名称统一为「广联Agent」。
- 本文档只约束 H5 端范围,不讨论后端接口实现、数据库、队列、任务和运行时能力。
- `web/` 管理后台前端的范围和规则以 `web/docs` 下的文档为准。
- H5 前台不采集任何埋点。
## 页面目标 ## 页面目标
官网 H5 前台展示页用于展示「广联岗位Agent」的岗位化智能服务体系。 官网 H5 前台展示页用于展示「广联Agent」的岗位化智能服务体系。
页面优先帮助用户建立“岗位 Agent 体系”的认知,再通过岗位体验入口引导用户扫码添加专属服务助手。 页面优先帮助用户建立“岗位 Agent 体系”的认知,再通过岗位体验入口引导用户扫码添加专属服务助手。
...@@ -32,7 +40,7 @@ PC 端展示规范后续补充,不在本文档展开。 ...@@ -32,7 +40,7 @@ PC 端展示规范后续补充,不在本文档展开。
Banner 内容全部来源于接口,包括标题、副标题、背景图等信息。 Banner 内容全部来源于接口,包括标题、副标题、背景图等信息。
主标题展示接口返回内容,当前确认标题为:`广联岗位Agent`。 主标题展示接口返回内容,当前确认标题为:`广联Agent`。
副标题展示接口返回内容,示例为:`AI驱动的智能销售服务体系`。 副标题展示接口返回内容,示例为:`AI驱动的智能销售服务体系`。
...@@ -139,4 +147,3 @@ Banner 图片缺失时需展示占位背景,保证页面可正常访问。 ...@@ -139,4 +147,3 @@ Banner 图片缺失时需展示占位背景,保证页面可正常访问。
PC 端展示效果后续补充。 PC 端展示效果后续补充。
当前阶段仅确认该页面需要兼容 PC 端访问。PC 端布局规则、模块排列和视觉细节将在后续单独补充。 当前阶段仅确认该页面需要兼容 PC 端访问。PC 端布局规则、模块排列和视觉细节将在后续单独补充。
...@@ -45,6 +45,12 @@ npm run build ...@@ -45,6 +45,12 @@ npm run build
- `/`:重定向到 `/components`。 - `/`:重定向到 `/components`。
- `/components`:UI 组件 Demo 承载路由。 - `/components`:UI 组件 Demo 承载路由。
目录演进原则:
- 当前优先保持 `src/App.tsx` 统一注册路由、`src/routes/` 存页面的模式。
- 菜单数量增加本身不构成重构理由,只有路由守卫、动态菜单、嵌套路由和路由元信息管理等复杂度上升时,才评估拆出 `src/router/`。
- 若后续需要演进,优先先抽路由配置和守卫,再考虑页面目录调整。
项目文档: 项目文档:
- [前端地基](./docs/frontend-foundation.md) - [前端地基](./docs/frontend-foundation.md)
......
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Codex API 等价费用估算</title>
<style>:root {
color-scheme: light;
--bg: #f7f8fb;
--panel: #ffffff;
--text: #1f2937;
--muted: #667085;
--border: #d8dee9;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.page {
width: min(1080px, calc(100vw - 32px));
margin: 0 auto;
padding: 32px 0 48px;
}
.hero { padding: 8px 0 18px; }
h1 {
margin: 0;
font-size: 34px;
line-height: 1.18;
letter-spacing: 0;
}
.hero p {
margin: 8px 0 18px;
color: var(--muted);
}
.meta-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 10px;
}
.meta-grid div,
.panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
}
.meta-grid div {
padding: 12px;
overflow-wrap: anywhere;
font-size: 18px;
font-weight: 700;
}
.meta-grid span {
display: block;
color: var(--muted);
font-size: 12px;
font-weight: 400;
margin-bottom: 5px;
}
.panel {
padding: 18px;
margin-top: 18px;
}
h2 {
margin: 0 0 14px;
font-size: 18px;
letter-spacing: 0;
}
.chart {
width: 100%;
height: auto;
display: block;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 10px;
color: var(--muted);
font-size: 13px;
}
.legend i {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 2px;
margin-right: 6px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
th, td {
padding: 10px 8px;
border-bottom: 1px solid var(--border);
text-align: right;
}
th:first-child, td:first-child { text-align: left; }
.notes {
color: var(--muted);
margin: 0;
}
.notes li { margin: 6px 0; }
@media (max-width: 760px) {
.page { width: min(100vw - 20px, 1080px); padding-top: 18px; }
.meta-grid { grid-template-columns: 1fr; }
h1 { font-size: 28px; }
}</style>
</head>
<body>
<main class="page">
<header class="hero">
<h1>Codex API 等价费用估算</h1>
<p>时间窗口: 2026-05-20T00:00:00+08:00 -> 2026-05-20T10:02:06.956313+08:00</p>
<div class="meta-grid">
<div><span>API 等价金额</span>$3.56</div>
<div><span>Codex Credits</span>88.91</div>
<div><span>Total Tokens</span>4,778,002</div>
<div><span>Reasoning</span>2,308</div>
<div><span>数据来源</span>/Users/yuehu/.codex</div>
<div><span>Generated</span>2026-05-20T10:02:07+08:00</div>
</div>
</header>
<section class="panel"><h2>费用构成</h2><svg class="chart" viewBox="0 0 920 230" role="img" aria-label="费用构成">
<text x="22" y="50" fill="#1f2937" font-size="15">非缓存 input</text>
<rect x="150" y="28" width="172.91" height="30" rx="4" fill="#0f766e" />
<text x="334.91" y="49" fill="#1f2937" font-size="15">$0.57</text>
<text x="22" y="108" fill="#1f2937" font-size="15">Cached input</text>
<rect x="150" y="86" width="700.00" height="30" rx="4" fill="#2563eb" />
<text x="862.00" y="107" fill="#1f2937" font-size="15">$2.32</text>
<text x="22" y="166" fill="#1f2937" font-size="15">Output</text>
<rect x="150" y="144" width="199.79" height="30" rx="4" fill="#f59e0b" />
<text x="361.79" y="165" fill="#1f2937" font-size="15">$0.66</text>
</svg>
<div class="legend"><span><i style="background:#0f766e"></i>非缓存 input: 16.1%</span><span><i style="background:#2563eb"></i>Cached input: 65.3%</span><span><i style="background:#f59e0b"></i>Output: 18.6%</span></div></section>
<section class="panel"><h2>明细</h2><table>
<thead><tr><th>类型</th><th>Tokens</th><th>单价</th><th>美元估算</th><th>Codex Credits</th></tr></thead>
<tbody>
<tr><td>非缓存 input</td><td>114,644</td><td>$5 / 1M</td><td>$0.57</td><td>14.33</td></tr>
<tr><td>Cached input</td><td>4,641,280</td><td>$0.5 / 1M</td><td>$2.32</td><td>58.02</td></tr>
<tr><td>Output</td><td>22,078</td><td>$30 / 1M</td><td>$0.66</td><td>16.56</td></tr>
<tr><td><strong>合计</strong></td><td><strong>4,778,002</strong></td><td>-</td><td><strong>$3.56</strong></td><td><strong>88.91</strong></td></tr>
</tbody>
</table></section>
<section class="panel"><h2>说明:</h2><ul class="notes">
<li>这是基于本机 Codex token_count 日志的 API 等价估算,不代表订阅真实账单。</li>
<li>Reasoning token 只做展示,已经包含在 output 口径里,不重复计费。</li>
<li>模型或 rate card 变化时,可以通过费率参数调整单价。</li>
</ul></section>
</main>
</body>
</html>
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Codex 用量图表</title>
<style>:root {
color-scheme: light;
--bg: #f7f8fb;
--panel: #ffffff;
--text: #1f2937;
--muted: #667085;
--border: #d8dee9;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.page {
width: min(1120px, calc(100vw - 32px));
margin: 0 auto;
padding: 32px 0 48px;
}
.hero {
padding: 8px 0 18px;
}
h1 {
margin: 0;
font-size: 34px;
line-height: 1.18;
letter-spacing: 0;
}
.hero p {
margin: 8px 0 18px;
color: var(--muted);
}
.meta-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 10px;
}
.meta-grid div,
.card,
.panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
}
.meta-grid div {
padding: 12px;
overflow-wrap: anywhere;
font-size: 13px;
}
.meta-grid span,
.card span {
display: block;
color: var(--muted);
font-size: 12px;
margin-bottom: 5px;
}
.panel {
padding: 18px;
margin-top: 18px;
}
h2 {
margin: 0 0 14px;
font-size: 18px;
letter-spacing: 0;
}
.cards {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
}
.card {
padding: 14px;
}
.card strong {
display: block;
font-size: 24px;
line-height: 1.15;
overflow-wrap: anywhere;
}
.chart {
width: 100%;
height: auto;
display: block;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 10px;
color: var(--muted);
font-size: 13px;
}
.legend i {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 2px;
margin-right: 6px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
th, td {
padding: 10px 8px;
border-bottom: 1px solid var(--border);
text-align: right;
}
th:first-child, td:first-child,
th:nth-child(2), td:nth-child(2) {
text-align: left;
}
td:first-child {
overflow-wrap: anywhere;
}
.empty,
.notes {
color: var(--muted);
margin: 0;
}
.notes li {
margin: 6px 0;
}
@media (max-width: 760px) {
.page { width: min(100vw - 20px, 1120px); padding-top: 18px; }
.meta-grid,
.cards { grid-template-columns: 1fr; }
h1 { font-size: 28px; }
.card strong { font-size: 22px; }
}</style>
</head>
<body>
<main class="page">
<header class="hero">
<h1>Codex 用量图表</h1>
<p>基于本地 token_count 日志生成</p>
<div class="meta-grid">
<div><span>时间窗口</span>2026-05-20T00:00:00+08:00 -> 2026-05-20T10:02:06.956313+08:00</div>
<div><span>数据来源</span>/Users/yuehu/.codex</div>
<div><span>生成时间</span>2026-05-20T10:02:07+08:00</div>
</div>
</header>
<section class="panel"><h2>总览</h2><div class="cards"><div class="card"><span>Total</span><strong>4,778,002</strong></div><div class="card"><span>Input</span><strong>4,755,924</strong></div><div class="card"><span>Cached Input</span><strong>4,641,280</strong></div><div class="card"><span>Non-cached Input</span><strong>114,644</strong></div><div class="card"><span>Output</span><strong>22,078</strong></div><div class="card"><span>Reasoning</span><strong>2,308</strong></div><div class="card"><span>Sessions</span><strong>1</strong></div><div class="card"><span>事件数</span><strong>103</strong></div></div></section>
<section class="panel"><h2>Token 构成</h2><svg class="chart" viewBox="0 0 900 116" role="img" aria-label="Token 构成">
<rect x="28" y="34" width="844" height="34" fill="#eef2f7" rx="6" />
<rect x="28.00" y="34" width="819.85" height="34" fill="#2563eb" />
<rect x="847.85" y="34" width="20.25" height="34" fill="#0f766e" />
<rect x="868.10" y="34" width="3.90" height="34" fill="#f59e0b" />
<text x="28" y="24" fill="#667085" font-size="13">Total: 4,778,002</text>
</svg>
<div class="legend"><span><i style="background:#2563eb"></i>Cached Input: 4,641,280 (97.1%)</span><span><i style="background:#0f766e"></i>Non-cached Input: 114,644 (2.4%)</span><span><i style="background:#f59e0b"></i>Output: 22,078 (0.5%)</span></div></section>
<section class="panel"><h2>随时间变化</h2><svg class="chart" viewBox="0 0 960 330" role="img" aria-label="随时间变化">
<line x1="78" y1="246.00" x2="920" y2="246.00" stroke="#d8dee9" />
<text x="68" y="250.00" fill="#667085" font-size="12" text-anchor="end">0</text>
<line x1="78" y1="191.00" x2="920" y2="191.00" stroke="#d8dee9" />
<text x="68" y="195.00" fill="#667085" font-size="12" text-anchor="end">1.2M</text>
<line x1="78" y1="136.00" x2="920" y2="136.00" stroke="#d8dee9" />
<text x="68" y="140.00" fill="#667085" font-size="12" text-anchor="end">2.4M</text>
<line x1="78" y1="81.00" x2="920" y2="81.00" stroke="#d8dee9" />
<text x="68" y="85.00" fill="#667085" font-size="12" text-anchor="end">3.6M</text>
<line x1="78" y1="26.00" x2="920" y2="26.00" stroke="#d8dee9" />
<text x="68" y="30.00" fill="#667085" font-size="12" text-anchor="end">4.8M</text>
<rect x="788.18" y="32.30" width="34.00" height="213.70" fill="#2563eb" />
<rect x="788.18" y="27.02" width="34.00" height="5.28" fill="#0f766e" />
<rect x="788.18" y="26.00" width="34.00" height="1.02" fill="#f59e0b" />
<line x1="78" y1="246" x2="920" y2="246" stroke="#667085" />
<text x="116.27" y="270.00" fill="#667085" font-size="12" text-anchor="middle">00:00</text>
<text x="192.82" y="270.00" fill="#667085" font-size="12" text-anchor="middle">01:00</text>
<text x="269.36" y="270.00" fill="#667085" font-size="12" text-anchor="middle">02:00</text>
<text x="345.91" y="270.00" fill="#667085" font-size="12" text-anchor="middle">03:00</text>
<text x="422.45" y="270.00" fill="#667085" font-size="12" text-anchor="middle">04:00</text>
<text x="499.00" y="270.00" fill="#667085" font-size="12" text-anchor="middle">05:00</text>
<text x="575.55" y="270.00" fill="#667085" font-size="12" text-anchor="middle">06:00</text>
<text x="652.09" y="270.00" fill="#667085" font-size="12" text-anchor="middle">07:00</text>
<text x="728.64" y="270.00" fill="#667085" font-size="12" text-anchor="middle">08:00</text>
<text x="805.18" y="270.00" fill="#667085" font-size="12" text-anchor="middle">09:00</text>
<text x="881.73" y="270.00" fill="#667085" font-size="12" text-anchor="middle">10:00</text>
</svg>
<div class="legend"><span><i style="background:#2563eb"></i>Cached Input</span><span><i style="background:#0f766e"></i>Non-cached Input</span><span><i style="background:#f59e0b"></i>Output</span></div></section>
<section class="panel"><h2>限额变化</h2><svg class="chart" viewBox="0 0 960 290" role="img" aria-label="限额变化">
<line x1="78" y1="216.00" x2="920" y2="216.00" stroke="#d8dee9" />
<text x="68" y="220.00" fill="#667085" font-size="12" text-anchor="end">0%</text>
<line x1="78" y1="168.50" x2="920" y2="168.50" stroke="#d8dee9" />
<text x="68" y="172.50" fill="#667085" font-size="12" text-anchor="end">25%</text>
<line x1="78" y1="121.00" x2="920" y2="121.00" stroke="#d8dee9" />
<text x="68" y="125.00" fill="#667085" font-size="12" text-anchor="end">50%</text>
<line x1="78" y1="73.50" x2="920" y2="73.50" stroke="#d8dee9" />
<text x="68" y="77.50" fill="#667085" font-size="12" text-anchor="end">75%</text>
<line x1="78" y1="26.00" x2="920" y2="26.00" stroke="#d8dee9" />
<text x="68" y="30.00" fill="#667085" font-size="12" text-anchor="end">100%</text>
<circle cx="835.80" cy="174.20" r="4" fill="#dc2626"><title>primary 已用 22%</title></circle>
<circle cx="835.80" cy="210.30" r="4" fill="#4f46e5"><title>secondary 已用 3%</title></circle>
<line x1="78" y1="216" x2="920" y2="216" stroke="#667085" />
<text x="78.00" y="240.00" fill="#667085" font-size="12" text-anchor="middle">00:00</text>
<text x="162.20" y="240.00" fill="#667085" font-size="12" text-anchor="middle">01:00</text>
<text x="246.40" y="240.00" fill="#667085" font-size="12" text-anchor="middle">02:00</text>
<text x="330.60" y="240.00" fill="#667085" font-size="12" text-anchor="middle">03:00</text>
<text x="414.80" y="240.00" fill="#667085" font-size="12" text-anchor="middle">04:00</text>
<text x="499.00" y="240.00" fill="#667085" font-size="12" text-anchor="middle">05:00</text>
<text x="583.20" y="240.00" fill="#667085" font-size="12" text-anchor="middle">06:00</text>
<text x="667.40" y="240.00" fill="#667085" font-size="12" text-anchor="middle">07:00</text>
<text x="751.60" y="240.00" fill="#667085" font-size="12" text-anchor="middle">08:00</text>
<text x="835.80" y="240.00" fill="#667085" font-size="12" text-anchor="middle">09:00</text>
<text x="920.00" y="240.00" fill="#667085" font-size="12" text-anchor="middle">10:00</text>
</svg>
<div class="legend"><span><i style="background:#dc2626"></i>primary 已用</span><span><i style="background:#4f46e5"></i>secondary 已用</span></div></section>
<section class="panel"><h2>Session 排行</h2><table>
<thead><tr><th>Session</th><th>最后事件</th><th>Total</th><th>Output</th><th>Reasoning</th></tr></thead>
<tbody>
<tr><td>rollout-2026-05-20T09-37-23-019e4307-c5c3-7791-8b85-73f4f49d3c31.jsonl</td><td>2026-05-20T09:58:07.634000+08:00</td><td>4,778,002</td><td>22,078</td><td>2,308</td></tr>
</tbody>
</table></section>
<section class="panel"><h2>说明</h2><ul class="notes">
<li>数值来自本机 Codex session 日志里的 token_count 事件。</li>
<li>Cached Input 是 Input 的子集。</li>
<li>Reasoning 单独展示,不会在 Token 构成里重复相加。</li>
</ul></section>
</main>
</body>
</html>
...@@ -8,6 +8,14 @@ ...@@ -8,6 +8,14 @@
当前阶段不把这些规则上升为 monorepo 全局前端地基。后续只有在多个项目复用并验证稳定后,再迁移或沉淀到 `architecture-spec/docs/architecture/`。 当前阶段不把这些规则上升为 monorepo 全局前端地基。后续只有在多个项目复用并验证稳定后,再迁移或沉淀到 `architecture-spec/docs/architecture/`。
## 1.1 项目范围确认
- `workspace/agent-admin/web` 负责管理后台前端。
- `workspace/agent-admin/single-page` 负责官网移动端 H5。
- `web/` 产品名称统一为「岗位Agent管理后台」。
- 本文档只约束 `web/` 项目,不讨论后端接口实现、数据库、队列、任务和运行时能力。
- `single-page/` 的范围、命名和页面规则以 `single-page/docs` 下的文档为准。
## 2. 当前边界 ## 2. 当前边界
本项目当前负责岗位Agent管理后台 Web 页面: 本项目当前负责岗位Agent管理后台 Web 页面:
...@@ -58,6 +66,9 @@ Tailwind CSS 暂不作为本项目已启用能力。后续如业务页面确有 ...@@ -58,6 +66,9 @@ Tailwind CSS 暂不作为本项目已启用能力。后续如业务页面确有
- `/components` 当前作为组件 Demo 路由。 - `/components` 当前作为组件 Demo 路由。
- 后续业务页面应按模块进入 `src/routes/<module>/`,再由统一路由入口注册。 - 后续业务页面应按模块进入 `src/routes/<module>/`,再由统一路由入口注册。
- 管理后台页面默认使用项目基础布局,不在单个页面里重复实现侧边导航、顶部区域和基础内容容器。 - 管理后台页面默认使用项目基础布局,不在单个页面里重复实现侧边导航、顶部区域和基础内容容器。
- 当前阶段优先采用 `src/App.tsx` 统一注册路由、`src/routes/` 存页面的模式,不因为菜单数量增加就提前重构目录。
- 当路由守卫、动态菜单、嵌套路由、路由元信息管理等路由治理复杂度明显上升时,再按实际业务需要评估是否拆出 `src/router/`。
- 路由结构演进遵循“先抽路由配置/守卫,再调整页面目录”的原则,尽量避免一次性迁移页面和路由两层职责。
## 6. 组件使用规则 ## 6. 组件使用规则
...@@ -78,6 +89,8 @@ Tailwind CSS 暂不作为本项目已启用能力。后续如业务页面确有 ...@@ -78,6 +89,8 @@ Tailwind CSS 暂不作为本项目已启用能力。后续如业务页面确有
破坏性操作默认使用二次确认。表单字段错误显示在字段附近,非字段错误可使用全局反馈。 破坏性操作默认使用二次确认。表单字段错误显示在字段附近,非字段错误可使用全局反馈。
后台管理页面的埋点规则以对应需求文档和页面确认文档为准,当前只采集页面打开及少量指定操作事件。
## 8. 测试与验证规则 ## 8. 测试与验证规则
修改本项目代码时,至少按影响范围运行: 修改本项目代码时,至少按影响范围运行:
...@@ -91,4 +104,3 @@ npm run build ...@@ -91,4 +104,3 @@ npm run build
新增或修改页面交互时,应优先补充 Vitest + React Testing Library 测试。无法合理自动化覆盖的布局和关键交互,需要通过浏览器验证记录结果。 新增或修改页面交互时,应优先补充 Vitest + React Testing Library 测试。无法合理自动化覆盖的布局和关键交互,需要通过浏览器验证记录结果。
本文档本身只整理项目级规范,不改变页面功能代码。 本文档本身只整理项目级规范,不改变页面功能代码。
## Context
`workspace/agent-admin/web` 已经具备 Vite React 应用、项目内 UI 基础组件、页面模式草案和前端契约草案。产品决策已确认后台产品名、管理员单角色范围、首个切片使用前端本地登录,以及 Agent 管理作为核心模块。本次 OpenSpec 在实现前锁定第一个行为切片:登录、受保护后台框架、Agent 管理列表和最小 mock/契约。
后端技术栈和运行时 Agent 能力不属于本次前端变更。登录本期不调用接口,Agent 列表 mock 契约只描述页面数据和页面状态,不承诺后端存储或服务设计。
## Goals / Non-Goals
**Goals:**
- 提供可用的前端本地登录入口,用于进入管理后台。
- 提供可复用的受保护后台框架,服务当前和后续后台页面。
- 将 Agent 管理列表页作为登录后的默认业务落点。
- 定义后台头部用户区、左侧导航密度,以及 Agent 列表筛选、表格、分页、行操作和页面状态。
- 定义本页面切片所需的最小 mock/契约字段。
**Non-Goals:**
- 不实现真实鉴权接口、JWT 刷新、用户信息接口或权限矩阵。
- 不在本次变更中实现 Agent 新增/编辑表单。
- 不实现 Agent 群管理、官网配置、岗位标签 CRUD 或 Skill 目录页面。
- 不决定后端框架、数据库、队列、任务或运行时 Agent 行为。
## Decisions
### Decision: 使用前端本地登录态
登录页在浏览器内校验固定账号密码 `admin` / `123456`,并在本地持久化简单登录标记,使刷新后仍保持在管理后台内。这符合已确认的一期边界,也避免在后端契约准备好之前虚构鉴权实现。
备选方案:仅使用会话态。它更简单,但刷新后会退出登录,会让后台页面日常开发更打断。
备选方案:mock 登录接口。它更接近未来后端形态,但会引入需求明确排除的接口面。
### Decision: 使用受保护后台框架承载业务路由
已登录业务页面放在共享后台框架下,框架包含产品标识、导航和退出登录。未登录访问受保护路由时跳转登录页。登录成功后优先回到原本访问的受保护路由;没有原始目标时进入 Agent 管理。
备选方案:在后台框架内嵌登录页。这样会弱化访问边界,也会让布局状态更难推理。
### Decision: 后台头部使用右侧用户区承载退出登录
后台框架头部右侧使用固定用户区,至少包含头像和 `退出登录` 按钮。这样能让用户身份和退出动作在所有受保护页面保持稳定位置,也与后台类产品的顶部操作习惯一致。
备选方案:只保留纯文本退出入口。它实现更快,但缺少用户区锚点,视觉上也不利于形成稳定的后台顶栏结构。
补充约束:点击 `退出登录` 后 SHALL 先弹出二次确认,再在确认后清除本地登录态并返回登录页,避免误触导致当前后台操作上下文丢失。
### Decision: 左侧一级菜单只承担分组表达
后台左侧导航中,`Agent管理` 作为一级分组项展示时 SHALL NOT 使用主选中样式,也不承担当前页面的主激活态;当前页面的主选中态只由 `Agent列表` 这样的二级项承担。这样可以避免一级菜单与二级菜单同时像“已选中”,让层级关系更清晰。
备选方案:一级菜单也使用轻度选中样式。该方案被拒绝,因为用户已经明确要求一级菜单不需要选中效果,过强的父级高亮会让层级焦点不够纯粹。
### Decision: 左侧导航使用紧凑间距并保证产品名不换行
左侧导航区域采用更紧凑的内边距和标题排版,避免 `岗位Agent管理后台` 在默认桌面宽度下换行。这样可以优先保证后台产品识别和扫描效率,而不是把空间消耗在过大的留白上。
备选方案:保留较大边距并允许标题换行。该方案被拒绝,因为会降低后台导航的信息密度,也会让首屏左侧结构显得松散。
补充约束:Agent 管理在左侧导航中 SHALL 作为一级菜单展示,`Agent列表` SHALL 作为当前选中的二级菜单展示;一级菜单需保留轻度选中样式,二级菜单承担主选中样式,便于后台用户感知当前信息架构层级。
补充约束:后台页面 SHALL 复用共享导航组件承载左侧菜单层级、展开和选中态,不在 `AdminShell` 或业务页面中手写导航 DOM 结构、交互状态和选中样式;若现有组件能力不足,应先在组件库 change 中补齐。
### Decision: 将 Agent 管理列表作为首个业务页
登录后的默认受保护路由使用 Agent 管理列表页,因为登录流程需要一个有效业务落点,且 Agent 管理是第一个已确认的后台模块。后续模块可以继续加入导航,而不必改变登录行为。
备选方案:增加仪表盘占位页。它会引入一个没有明确业务价值的页面,并推迟真实列表页契约的验证。
### Decision: mock 契约按页面需要收敛
Agent 列表 mock 只包含当前列表页和筛选控件需要的字段:Agent 标识、管家 Agent 标记、岗位、状态、绑定群数、绑定 Skill 数、更新时间和可用操作。同时提供岗位筛选选项和页面状态 fixtures。这样可以让前端具备可测试性,同时不锁定后端实现细节。
备选方案:直接复制更宽的后端接口草案。这会过度规定本切片不展示的字段,也会在后端对齐变化时制造额外返工。
### Decision: 查询区使用标准后台表单布局和显式操作按钮
Agent 列表查询区使用 `Agent名称` 搜索框、`所属岗位` 下拉框和 `状态` 下拉框的同一行后台表单布局,并显式提供 `搜索` 与 `重置` 按钮。搜索框与两个下拉框宽度统一为 `200px`,避免首个业务页出现控件宽度和交互入口不一致的问题。
备选方案:输入即筛选且不提供操作按钮。它交互更轻,但不符合当前后台页面的明确确认口径,也不利于把查询条件和执行动作区分开。
补充约束:`所属岗位` 下拉框默认展示 `全部岗位` 占位,并在下拉选项中提供 `全部` 选项,用户可通过重新选择 `全部` 取消岗位筛选;一旦已选择具体岗位,不再通过额外清空按钮暴露取消动作,避免控件下方出现与后台表单不一致的“清空”入口。
补充约束:当用户切换 `所属岗位` 或 `状态` 下拉选项时,页面仅更新当前表单值,不立即触发列表搜索;只有用户点击 `搜索` 按钮后,才把当前表单值作为一次查询条件提交。
补充约束:选择类下拉框在用户选中某个选项后 SHALL 立即关闭下拉面板,避免保留下拉浮层遮挡后续查询区内容;该行为由共享选择组件承载,业务页面直接复用。
补充约束:查询区中承载 `所属岗位` 和 `状态` 的外层结构 SHALL 使用普通布局容器,不得使用原生 `label` 包裹下拉选择器,以免浏览器原生 label 激活行为干扰下拉收起。
### Decision: 页面样式优先使用 Tailwind CSS 原子类
本切片页面开发中,样式实现以 Tailwind CSS 为主,不为该功能额外新增独立样式文件。这样可以保持样式实现方式一致,减少查询区、导航和头部等小范围界面的样式分散。
备选方案:为本切片继续增加独立样式文件。它局部上也能实现需求,但会让样式维护方式和当前项目约定不一致。
### Decision: 前端分页以总条数和 page_size 计算页数
分页展示必须根据 `total` 和 `page_size` 计算真实页数;当总数为 6 且每页 10 条时,只展示 1 页。这样可以避免 mock 场景和后续真实接口联调时出现多余分页页码。
备选方案:根据本地切片数组或错误边界值推导页数。该方案被拒绝,因为它会直接导致分页显示与列表总数不一致。
补充约束:分页组件的 `每页条数` 选择 SHALL 由页面接住并更新列表查询条件,不能只改控件显示而不刷新结果;页大小变化后应回到第一页,避免当前页在新页大小下越界。
### Decision: 使用组件库状态占位表达列表失败态
Agent 管理列表页的加载失败状态 SHALL 使用组件库 `StatePlaceholder` 的 `error` 语义表达,展示加载失败文案和重试操作,并保留后台框架、筛选区和导航可用。请求失败时当前数据是否为空未知,因此失败态 SHALL NOT 使用“暂无数据”作为主文案;空数据和筛选无结果才使用空态或筛选无结果语义。
备选方案:失败时复用 `Empty` 或表格默认空态。该方案被拒绝,因为它会把“请求成功但没有数据”和“请求失败导致数据未知”混在一起,容易误导用户判断列表真实为空。
## Risks / Trade-offs
- 本地登录不具备真实安全性 → 缓解:明确记录为一期前端访问门禁,不把它表述为后端鉴权。
- mock 契约可能与未来后端接口不一致 → 缓解:保持 mock 面向页面,差异记录在 `packages/contracts/frontend-api-contract.md`,待后端对齐后用后续 OpenSpec 调整。
- Agent 列表操作规则依赖管家 Agent 身份 → 缓解:在页面契约中加入明确的 `is_manager` 标记,避免 UI 从显示文案推断特殊行为。
- 首个切片不包含新增/编辑表单 → 缓解:导航和行操作可以暴露预期入口,但未实现流程应按实现任务处理为禁用、占位或后续路由。
- 列表请求失败可能被误实现成表格空态 → 缓解:明确失败态使用 `StatePlaceholder state="error"` 和重试操作,且不得展示“暂无数据”主文案。
- 查询区控件尺寸和布局可能因临时样式实现而不一致 → 缓解:在需求中固定字段顺序、按钮和 `200px` 宽度要求,并约束使用 Tailwind CSS 统一实现。
- 查询区岗位筛选如果同时提供“全部”选项和独立清空按钮,容易让用户难以判断哪一个是标准重置入口 → 缓解:明确改为通过下拉选项中的 `全部` 完成重置,并隐藏已选状态下的清空按钮。
- 查询区如果用原生 `label` 包裹 `Select`,浏览器可能把选项点击重新解释为控件激活 → 缓解:明确改用普通容器承载字段说明和控件,避免原生 label 语义干扰。
- 分页页数可能与总数不一致 → 缓解:在需求和任务中明确分页按 `total` 与 `page_size` 计算,并把 `total=6`、`page_size=10` 仅一页作为验证场景。
## Migration Plan
这是一个新增型前端变更。实现时可以在正常本地开发构建中接入 mock 数据。回滚方式为撤销路由、登录态 helper、后台框架和 Agent 列表页相关文件。
## Open Questions
- 本 OpenSpec 切片暂无待确认问题。设计默认采用已确认口径:登录后进入 Agent 管理列表页,登录态本地持久化以支持刷新后保持登录。
## Why
岗位Agent管理后台需要先落下第一个可实现的产品切片,为后续 Agent 群管理、官网配置等模块提供稳定的登录入口、后台框架和列表页契约。本次变更把已确认的前端本地登录和 Agent 管理列表需求固化为 OpenSpec 规范,作为编码前的行为依据。
## What Changes
- 新增前端本地登录流程,产品名称为 `岗位Agent管理后台`,固定账号密码为 `admin` / `123456`。
- 新增管理后台的受保护路由、登录态本地持久化,以及顶部右侧头像加 `退出登录` 按钮的退出登录行为。
- 新增初始管理后台框架,包含适用于 Agent 管理和后续后台模块的导航结构。
- 新增 Agent 管理列表页,覆盖带 `搜索` / `重置` 按钮的查询区、岗位筛选、状态筛选、表格、分页、加载中、空数据、筛选无结果和失败状态。
- 新增列表行操作规则,覆盖编辑、上架、停用、删除,并为高影响操作提供确认。
- 调整退出登录、Agent 管理菜单层级和岗位筛选交互,使后台框架与列表查询区符合最新确认口径。
- 调整左侧一级菜单、筛选提交时机和分页页大小切换的交互,使管理页的导航和查询体验保持一致。
- 收紧 Agent 列表查询区的容器语义,避免原生 `label` 包裹下拉选择器导致选中后行为不稳定。
- 新增本切片所需的最小 mock 与契约边界,不定义后端实现、存储方案或运行时架构。
## Capabilities
### New Capabilities
- `admin-login`:管理后台前端本地登录、登录态持久化、路由守卫和退出登录行为。
- `admin-shell`:受保护的管理后台布局、导航、头部操作和默认落点行为。
- `agent-management-list`:Agent 管理列表页行为、筛选、表格字段、分页、页面状态、行操作和最小 mock/契约要求。
### Modified Capabilities
- 无。
## Impact
- 影响应用范围:`workspace/agent-admin/web`。
- 影响 UI 行为:登录页、受保护布局、顶部用户区、左侧导航、Agent 管理列表页查询区、高影响操作确认和本地 mock 数据状态。
- 影响共享组件:`Select` 需要补齐下拉选择后的自动收起和按业务关闭清空入口能力。
- 影响共享组件:`Navigation` 需要区分一级分组态和二级选中态,`Pagination` 需要正确接收页大小变更。
- 影响契约范围:Agent 列表和岗位筛选选项所需的前端 mock 结构与页面级数据契约。
- 影响查询区语义:所属岗位和状态筛选的外层容器需要采用普通布局容器,而不是原生 `label`。
- 后端影响:不新增登录接口,不决定后端框架,不设计数据库或队列,不改变运行时 Agent 行为。
## ADDED Requirements
### Requirement: 登录页展示
岗位 Agent 管理后台 SHALL 在用户访问受保护管理页面前提供 `岗位Agent管理后台` 登录页。
#### Scenario: 打开登录页
- **WHEN** 未登录用户打开登录路由
- **THEN** 登录页展示产品名称 `岗位Agent管理后台`
- **AND** 登录页展示账号、密码和登录控件
### Requirement: 本地账号密码校验
岗位 Agent 管理后台 SHALL 在本地校验一期固定账号密码,账号为 `admin`,密码为 `123456`。
#### Scenario: 登录成功
- **WHEN** 用户提交账号 `admin` 和密码 `123456`
- **THEN** 岗位 Agent 管理后台在本地记录用户已登录
- **AND** 岗位 Agent 管理后台跳转到用户原本请求的受保护路由;如果没有原始目标,则跳转到 Agent 管理列表页
#### Scenario: 账号为空
- **WHEN** 用户提交登录表单且账号为空
- **THEN** 登录页在账号字段展示必填提示
- **AND** 岗位 Agent 管理后台不把用户标记为已登录
#### Scenario: 密码为空
- **WHEN** 用户提交登录表单且密码为空
- **THEN** 登录页在密码字段展示必填提示
- **AND** 岗位 Agent 管理后台不把用户标记为已登录
#### Scenario: 账号或密码错误
- **WHEN** 用户提交的账号或密码与固定账号密码不匹配
- **THEN** 登录页展示 `账号或密码错误`
- **AND** 岗位 Agent 管理后台不把用户标记为已登录
### Requirement: 受保护路由守卫
岗位 Agent 管理后台 SHALL 阻止未登录用户查看受保护的管理页面。
#### Scenario: 未登录访问受保护路由
- **WHEN** 未登录用户打开受保护管理路由
- **THEN** 岗位 Agent 管理后台将用户重定向到登录路由
- **AND** 岗位 Agent 管理后台保留用户原本想访问的受保护目标,用于登录成功后跳转
### Requirement: 本地登录态持久化与退出登录
岗位 Agent 管理后台 SHALL 在页面刷新后保留本地登录态,并在用户退出登录时清除本地登录态。
#### Scenario: 登录后刷新
- **WHEN** 已登录用户刷新受保护管理页面
- **THEN** 岗位 Agent 管理后台保持用户停留在受保护管理页面
#### Scenario: 退出登录
- **WHEN** 已登录用户触发退出登录
- **THEN** 岗位 Agent 管理后台先展示退出登录二次确认
- **AND** 仅在用户确认后清除本地登录态
- **AND** 岗位 Agent 管理后台跳转到登录路由
#### Scenario: 取消退出登录
- **WHEN** 已登录用户触发退出登录后取消二次确认
- **THEN** 岗位 Agent 管理后台保持当前登录态
- **AND** 用户继续停留在当前受保护页面
### Requirement: 不调用登录相关接口
岗位 Agent 管理后台 SHALL NOT 在一期登录流程中调用后端登录、退出登录、用户信息、token 刷新或鉴权检查接口。
#### Scenario: 提交登录
- **WHEN** 用户提交任意登录账号密码
- **THEN** 岗位 Agent 管理后台在浏览器内完成校验
- **AND** 不需要发起任何鉴权接口请求
## ADDED Requirements
### Requirement: 受保护后台框架
岗位 Agent 管理后台 SHALL 在共享的受保护后台框架内展示管理页面。
#### Scenario: 展示受保护页面
- **WHEN** 已登录用户打开受保护管理页面
- **THEN** 岗位 Agent 管理后台展示共享后台框架
- **AND** 后台框架标识产品为 `岗位Agent管理后台`
- **AND** 后台框架在顶部右侧提供头像和 `退出登录` 按钮
### Requirement: 管理后台导航
岗位 Agent 管理后台 SHALL 将 Agent 管理作为首个可用管理模块提供导航,并为后续已确认模块保留扩展空间。
#### Scenario: Agent 管理路由激活
- **WHEN** 已登录用户打开 Agent 管理列表页
- **THEN** 后台框架将 `Agent管理` 显示为一级导航项
- **AND** 后台框架将 `Agent列表` 显示为其下的二级导航项
- **AND** `Agent列表` 使用主选中样式
- **AND** `Agent管理` 不使用主选中样式,只作为一级分组项展示
#### Scenario: 复用共享导航组件
- **WHEN** 后台框架渲染左侧导航
- **THEN** 后台框架通过共享 UI 导航组件渲染一级和二级菜单
- **AND** 后台框架 SHALL NOT 在页面内手写导航层级结构、选中态样式或展开交互
### Requirement: 左侧导航信息密度
岗位 Agent 管理后台 SHALL 使用适合桌面后台的左侧导航间距,并保证产品名称在默认桌面布局下不换行。
#### Scenario: 展示左侧导航
- **WHEN** 已登录用户在默认桌面宽度下查看后台框架
- **THEN** 左侧导航内边距保持紧凑,避免出现过大的顶部或左右留白
- **AND** 产品名称 `岗位Agent管理后台` 在左侧导航品牌区域保持单行展示
### Requirement: 默认受保护落点
岗位 Agent 管理后台 SHALL 将 Agent 管理列表页作为默认受保护落点。
#### Scenario: 已登录用户打开应用根路径
- **WHEN** 已登录用户打开应用根路径
- **THEN** 岗位 Agent 管理后台跳转到 Agent 管理列表页
#### Scenario: 登录成功且没有保存目标
- **WHEN** 登录成功且没有保存用户原本访问的受保护目标
- **THEN** 岗位 Agent 管理后台跳转到 Agent 管理列表页
### Requirement: 后台框架页面状态
岗位 Agent 管理后台 SHALL 在受保护页面展示加载中、空数据、筛选无结果或失败状态时,保持后台框架导航和退出登录可用。
#### Scenario: 页面数据加载失败
- **WHEN** Agent 管理列表页展示数据加载失败状态
- **THEN** 后台框架仍然可见
- **AND** 用户仍可导航或退出登录
## ADDED Requirements
### Requirement: Agent 列表页结构
岗位 Agent 管理后台 SHALL 提供 Agent 管理列表页,包含标题、搜索与筛选控件、主操作区、表格和分页。
#### Scenario: 打开 Agent 列表页
- **WHEN** 已登录用户打开 Agent 管理列表页
- **THEN** Agent 管理列表页展示页面标题 `Agent管理`
- **AND** Agent 管理列表页展示 Agent 名称搜索框、所属岗位下拉框、状态下拉框、`搜索` 按钮、`重置` 按钮、表格和分页控件
### Requirement: Agent 列表查询控件
Agent 管理列表页 SHALL 允许用户按名称关键词、单个岗位和状态值 `全部`、`已上架`、`已停用` 查询 Agent。
#### Scenario: 提交关键词搜索
- **WHEN** 用户在 Agent 列表搜索控件中输入关键词并点击 `搜索`
- **THEN** Agent 管理列表页使用该关键词刷新列表
- **AND** Agent 管理列表页将分页行为保持为筛选结果第一页
#### Scenario: 切换岗位筛选
- **WHEN** 用户选择一个岗位筛选选项
- **THEN** Agent 管理列表页仅更新当前岗位筛选值
- **AND** Agent 管理列表页不会立即刷新列表
#### Scenario: 选择全部岗位
- **WHEN** 用户打开所属岗位下拉框
- **THEN** 下拉选项中包含 `全部` 选项
- **AND** 用户选择 `全部` 后,Agent 管理列表页取消岗位筛选
#### Scenario: 切换状态筛选
- **WHEN** 用户选择 `已上架` 或 `已停用`
- **THEN** Agent 管理列表页仅更新当前状态筛选值
- **AND** Agent 管理列表页不会立即刷新列表
#### Scenario: 提交筛选条件
- **WHEN** 用户已调整关键词、岗位或状态筛选值后点击 `搜索`
- **THEN** Agent 管理列表页使用当前表单中的关键词、岗位和状态条件刷新列表
- **AND** Agent 管理列表页将分页行为保持为筛选结果第一页
#### Scenario: 重置查询条件
- **WHEN** 用户在 Agent 列表页点击 `重置`
- **THEN** Agent 管理列表页清空关键词、所属岗位和状态筛选值
- **AND** Agent 管理列表页恢复默认查询条件并回到第 `1` 页
#### Scenario: 查询区字段与顺序
- **WHEN** 用户查看 Agent 列表查询区
- **THEN** 查询区按 `Agent名称`、`所属岗位`、`状态` 的顺序展示字段标签和对应控件
- **AND** 查询区采用左右结构,字段标签在左、输入/下拉控件在右
- **AND** 查询区在右侧操作区展示 `搜索` 按钮和 `重置` 按钮
### Requirement: 查询区容器语义
Agent 管理列表页 SHALL 使用普通布局容器承载 `所属岗位` 和 `状态` 下拉框,不通过原生 `label` 包裹下拉选择器。
#### Scenario: 打开查询区
- **WHEN** 用户查看 Agent 列表查询区
- **THEN** `所属岗位` 和 `状态` 下拉框外层使用普通容器
- **AND** 下拉框点击选项时不会因为外层原生 `label` 的激活行为重新打开控件
#### Scenario: 查询区控件宽度
- **WHEN** 用户查看 Agent 名称搜索框、所属岗位下拉框和状态下拉框
- **THEN** 三个控件宽度保持一致
- **AND** 每个控件宽度为 `200px`
#### Scenario: 岗位筛选不展示额外清空按钮
- **WHEN** 用户已经选择具体岗位
- **THEN** 所属岗位控件下方不展示额外的 `清空` 按钮
- **AND** 用户可通过重新选择 `全部` 或点击查询区 `重置` 按钮恢复默认筛选
#### Scenario: 选择后收起下拉框
- **WHEN** 用户在所属岗位或状态下拉框中选择某个选项
- **THEN** 当前下拉面板立即关闭
### Requirement: Agent 表格列
Agent 管理列表页 SHALL 为每条 Agent 列表数据展示 Agent 名称、所属岗位、状态、绑定群数、绑定 Skill 数、更新时间和行操作。
#### Scenario: 展示普通 Agent 行
- **WHEN** 列表包含非管家 Agent
- **THEN** 行内展示 Agent 名称、岗位标签、状态标签、绑定群数、绑定 Skill 数、更新时间和允许执行的操作
#### Scenario: 展示管家 Agent 行
- **WHEN** 列表包含管家 Agent
- **THEN** 行内岗位展示为 `系统调度`
- **AND** 行内不展示绑定 Skill 数值
### Requirement: 管家 Agent 展示与排序
Agent 管理列表页 SHALL 在页面数据包含管家 Agent 时保持其可见,并将其置于普通 Agent 之前。
#### Scenario: 正常列表数据包含管家 Agent
- **WHEN** Agent 列表数据同时包含管家 Agent 和普通 Agent
- **THEN** Agent 管理列表页将管家 Agent 展示在普通 Agent 之前
#### Scenario: 不存在普通 Agent
- **WHEN** 不存在普通 Agent
- **THEN** 只要 mock 或页面数据提供管家 Agent,Agent 管理列表页仍展示管家 Agent
### Requirement: Agent 状态展示
Agent 管理列表页 SHALL 将启用 Agent 展示为 `已上架`,将停用 Agent 展示为 `已停用`,并使用视觉上可区分的状态标签。
#### Scenario: 展示已上架 Agent 行
- **WHEN** Agent 列表项状态为 `enable`
- **THEN** Agent 管理列表页展示状态文案 `已上架`
#### Scenario: 展示已停用 Agent 行
- **WHEN** Agent 列表项状态为 `disable`
- **THEN** Agent 管理列表页展示状态文案 `已停用`
### Requirement: Agent 行操作
Agent 管理列表页 SHALL 按 Agent 类型和状态展示行操作。
#### Scenario: 管家 Agent 操作
- **WHEN** 行数据代表管家 Agent
- **THEN** Agent 管理列表页允许编辑
- **AND** Agent 管理列表页不允许停用、上架或删除
#### Scenario: 已上架普通 Agent 操作
- **WHEN** 行数据代表已上架的非管家 Agent
- **THEN** Agent 管理列表页允许编辑、停用和删除
- **AND** 停用和删除在执行前需要确认
#### Scenario: 已停用普通 Agent 操作
- **WHEN** 行数据代表已停用的非管家 Agent
- **THEN** Agent 管理列表页允许编辑、上架和删除
- **AND** 删除在执行前需要确认
### Requirement: 删除确认
Agent 管理列表页 SHALL 在删除非管家 Agent 前展示已确认的删除影响文案。
#### Scenario: 请求删除
- **WHEN** 用户请求删除 Agent `复盘Agent`
- **THEN** 确认框展示 `确认删除 Agent "复盘Agent"?`
- **AND** 确认框说明该 Agent 的企微员工会从所有已关联群中退出、官网展示配置会被清理、渠道活码 Agent 列表中不再出现该 Agent、关联的岗位标签不受影响
### Requirement: 页面状态
Agent 管理列表页 SHALL 提供加载中、正常数据、空数据、筛选无结果和失败状态。
#### Scenario: 列表加载中
- **WHEN** Agent 列表数据正在加载
- **THEN** Agent 管理列表页在不离开受保护后台框架的情况下展示加载中状态
#### Scenario: 筛选无结果
- **WHEN** 当前搜索或筛选条件没有匹配的普通 Agent 行
- **THEN** Agent 管理列表页展示筛选无结果状态,并允许用户调整或清空筛选
#### Scenario: 数据加载失败
- **WHEN** Agent 列表数据加载失败
- **THEN** Agent 管理列表页使用组件库 `StatePlaceholder` 的 `error` 语义展示可恢复的失败状态
- **AND** Agent 管理列表页提供重试操作
- **AND** Agent 管理列表页 SHALL NOT 使用“暂无数据”作为失败态主文案
### Requirement: Agent 列表分页展示
Agent 管理列表页 SHALL 根据列表总数和每页条数展示正确的分页页码。
#### Scenario: 总数不足一页
- **WHEN** 当前列表总数为 `6` 且每页条数为 `10`
- **THEN** Agent 管理列表页只展示 `1` 页
- **AND** Agent 管理列表页不得展示第 `2` 页
#### Scenario: 切换每页条数
- **WHEN** 用户在分页中选择新的 `每页条数`
- **THEN** Agent 管理列表页更新当前每页条数
- **AND** Agent 管理列表页回到第 `1` 页
- **AND** 列表结果随新的每页条数重新计算
### Requirement: Agent 列表最小 mock 契约
前端 mock 契约 SHALL 提供本列表切片需要的 mock 数据和页面契约字段,并且不要求后端实现细节。
#### Scenario: 消费 mock Agent 列表项
- **WHEN** Agent 列表页渲染 mock Agent 项
- **THEN** 该项包含 `agent_id`、`name`、`is_manager`、`positions`、`status`、`bound_group_count`、`bound_skill_count`、`updated_at` 和可用操作信息
#### Scenario: 消费 mock 岗位选项
- **WHEN** Agent 列表页渲染岗位筛选
- **THEN** mock 契约提供包含稳定 id 和展示名称字段的岗位选项
#### Scenario: 消费 mock 页面状态 fixtures
- **WHEN** 测试或本地开发需要列表页状态
- **THEN** mock 契约提供正常数据、空数据、筛选无结果、加载中、失败、长文本、不可用操作和分页边界场景 fixtures
## 1. 路由与登录基础
- [x] 1.1 新增登录页、应用根路径重定向和 Agent 管理列表页的路由定义。
- [x] 1.2 新增本地登录态 helper,覆盖固定账号密码校验、登录态持久化、访问目标保留和退出登录。
- [x] 1.3 补充测试,覆盖登录成功、必填校验、账号密码错误、刷新后保持登录、受保护路由跳转和退出登录。
## 2. 受保护后台框架
- [x] 2.1 实现共享受保护后台框架,包含产品标识、Agent 管理导航、内容出口和退出登录控件。
- [x] 2.2 补充后台框架行为测试,覆盖 Agent 管理导航激活、登录后默认落点和页面失败状态下框架仍可见。
- [x] 2.3 验证后台框架布局符合 Web 桌面端后台设计规则:导航信息密度合理、视觉克制、不采用营销页构图。
- [x] 2.4 调整后台头部右侧用户区,明确展示头像和 `退出登录` 按钮,并更新对应测试。
- [ ] 2.5 收紧左侧导航间距,确保 `岗位Agent管理后台` 在默认桌面宽度下单行展示,并完成浏览器验证。
- [x] 2.6 基于共享 UI 导航组件将后台左侧导航调整为 `Agent管理` 一级菜单 + `Agent列表` 二级菜单,并确保一级菜单不展示主选中效果、二级菜单承担主选中样式,补充对应测试。
- [x] 2.7 为顶部 `退出登录` 增加二次确认弹窗,并补充确认/取消两条行为测试。
## 3. Agent 列表 mock 契约
- [x] 3.1 定义前端 Agent 列表 mock 类型和 fixtures,覆盖正常数据、仅管家 Agent、空数据、筛选无结果、加载中、失败、长文本、不可用操作和分页边界。
- [x] 3.2 更新 `packages/contracts/frontend-api-contract.md` 或相邻契约模块,记录列表页最小字段:`agent_id`、`name`、`is_manager`、`positions`、`status`、`bound_group_count`、`bound_skill_count`、`updated_at` 和可用操作。
- [x] 3.3 补充契约或 fixture 测试,证明 Agent 列表页可以在没有后端接口的情况下消费最小 mock 数据。
## 4. Agent 管理列表页
- [x] 4.1 实现 Agent 管理列表页结构,包含标题、关键词搜索、岗位筛选、状态筛选、主操作区、表格和分页。
- [x] 4.2 实现表格展示规则,覆盖管家 Agent 置顶、`系统调度` 岗位展示、管家 Agent 隐藏 Skill 数、状态标签、数量字段、更新时间和行操作。
- [x] 4.3 实现查询控件行为,覆盖关键词搜索、岗位单选筛选、状态筛选、回到第一页和分页。
- [x] 4.4 实现页面状态,覆盖加载中、正常数据、仅管家 Agent 或空数据、筛选无结果、失败和重试;失败态使用 `StatePlaceholder state="error"`,不得展示“暂无数据”主文案。
- [x] 4.5 实现行操作行为,覆盖编辑入口、上架、停用确认、删除确认和管家 Agent 操作限制。
- [x] 4.6 补充测试,覆盖列表渲染、筛选、分页、管家 Agent 规则、行操作可用性、删除确认文案和可恢复失败状态;断言失败态展示重试操作且不展示“暂无数据”主文案。
- [x] 4.7 调整查询区结构,按 `Agent名称`、`所属岗位`、`状态` 的顺序展示控件,并补齐 `搜索` / `重置` 按钮。
- [x] 4.8 将 Agent 名称搜索框、所属岗位下拉框和状态下拉框宽度统一为 `200px`,并使用 Tailwind CSS 实现,不为该功能新增独立样式文件。
- [x] 4.9 修正分页逻辑,确保总数 `6`、每页 `10` 条时只展示 `1` 页,同时接通每页条数切换并补充对应测试。
- [x] 4.10 调整所属岗位与状态筛选的外层结构,改用普通布局容器替代原生 `label` 包裹,避免选中后控件被重新激活,并补充对应测试。
- [x] 4.11 调整所属岗位筛选:下拉项补齐 `全部` 选项,已选具体岗位后不展示额外 `清空` 按钮,并补充对应测试。
- [x] 4.12 调整查询条件提交时机,确保所属岗位和状态下拉改值只更新表单状态、不自动触发搜索,只有点击 `搜索` 后才提交当前条件,并补充对应测试。
- [x] 4.13 修正查询区 `重置` 行为,确保已选择的所属岗位、状态和关键词都会清空,并补充对应测试。
## 5. Verification
- [x] 5.1 运行登录、后台框架、mock 契约和 Agent 列表行为相关单元测试。
- [x] 5.2 在 `workspace/agent-admin/web` 运行类型检查和生产构建。
- [x] 5.3 运行浏览器验证,覆盖登录、受保护路由跳转、退出登录、Agent 列表筛选、行操作、页面状态和桌面端响应式布局。
- [x] 5.4 重新运行浏览器验证,重点覆盖顶部用户区、左侧导航单行展示、查询区字段顺序、`搜索` / `重置` 按钮、`200px` 控件宽度和单页分页场景。
- [x] 5.5 重新运行浏览器验证,覆盖退出登录二次确认、左侧导航仅二级主选中且一级无主选中效果、所属岗位 `全部` 选项、下拉选择后自动收起、无额外清空按钮、岗位/状态下拉改值不自动搜索、每页条数切换生效,以及普通容器承载下拉控件后不会被 label 重新激活。
- [x] 5.6 重新运行浏览器验证,覆盖查询区 `重置` 后关键词、所属岗位、状态都回到默认值。
- [x] 5.7 请求 OpenSpec 归档前,按真实实现结果更新本任务清单。
# admin-login Specification
## Purpose
TBD - created by archiving change add-admin-login-agent-list-mock. Update Purpose after archive.
## Requirements
### Requirement: 登录页展示
岗位 Agent 管理后台 SHALL 在用户访问受保护管理页面前提供 `岗位Agent管理后台` 登录页。
#### Scenario: 打开登录页
- **WHEN** 未登录用户打开登录路由
- **THEN** 登录页展示产品名称 `岗位Agent管理后台`
- **AND** 登录页展示账号、密码和登录控件
### Requirement: 本地账号密码校验
岗位 Agent 管理后台 SHALL 在本地校验一期固定账号密码,账号为 `admin`,密码为 `123456`。
#### Scenario: 登录成功
- **WHEN** 用户提交账号 `admin` 和密码 `123456`
- **THEN** 岗位 Agent 管理后台在本地记录用户已登录
- **AND** 岗位 Agent 管理后台跳转到用户原本请求的受保护路由;如果没有原始目标,则跳转到 Agent 管理列表页
#### Scenario: 账号为空
- **WHEN** 用户提交登录表单且账号为空
- **THEN** 登录页在账号字段展示必填提示
- **AND** 岗位 Agent 管理后台不把用户标记为已登录
#### Scenario: 密码为空
- **WHEN** 用户提交登录表单且密码为空
- **THEN** 登录页在密码字段展示必填提示
- **AND** 岗位 Agent 管理后台不把用户标记为已登录
#### Scenario: 账号或密码错误
- **WHEN** 用户提交的账号或密码与固定账号密码不匹配
- **THEN** 登录页展示 `账号或密码错误`
- **AND** 岗位 Agent 管理后台不把用户标记为已登录
### Requirement: 受保护路由守卫
岗位 Agent 管理后台 SHALL 阻止未登录用户查看受保护的管理页面。
#### Scenario: 未登录访问受保护路由
- **WHEN** 未登录用户打开受保护管理路由
- **THEN** 岗位 Agent 管理后台将用户重定向到登录路由
- **AND** 岗位 Agent 管理后台保留用户原本想访问的受保护目标,用于登录成功后跳转
### Requirement: 本地登录态持久化与退出登录
岗位 Agent 管理后台 SHALL 在页面刷新后保留本地登录态,并在用户退出登录时清除本地登录态。
#### Scenario: 登录后刷新
- **WHEN** 已登录用户刷新受保护管理页面
- **THEN** 岗位 Agent 管理后台保持用户停留在受保护管理页面
#### Scenario: 退出登录
- **WHEN** 已登录用户触发退出登录
- **THEN** 岗位 Agent 管理后台先展示退出登录二次确认
- **AND** 仅在用户确认后清除本地登录态
- **AND** 岗位 Agent 管理后台跳转到登录路由
#### Scenario: 取消退出登录
- **WHEN** 已登录用户触发退出登录后取消二次确认
- **THEN** 岗位 Agent 管理后台保持当前登录态
- **AND** 用户继续停留在当前受保护页面
### Requirement: 不调用登录相关接口
岗位 Agent 管理后台 SHALL NOT 在一期登录流程中调用后端登录、退出登录、用户信息、token 刷新或鉴权检查接口。
#### Scenario: 提交登录
- **WHEN** 用户提交任意登录账号密码
- **THEN** 岗位 Agent 管理后台在浏览器内完成校验
- **AND** 不需要发起任何鉴权接口请求
# admin-shell Specification
## Purpose
TBD - created by archiving change add-admin-login-agent-list-mock. Update Purpose after archive.
## Requirements
### Requirement: 受保护后台框架
岗位 Agent 管理后台 SHALL 在共享的受保护后台框架内展示管理页面。
#### Scenario: 展示受保护页面
- **WHEN** 已登录用户打开受保护管理页面
- **THEN** 岗位 Agent 管理后台展示共享后台框架
- **AND** 后台框架标识产品为 `岗位Agent管理后台`
- **AND** 后台框架在顶部右侧提供头像和 `退出登录` 按钮
### Requirement: 管理后台导航
岗位 Agent 管理后台 SHALL 将 Agent 管理作为首个可用管理模块提供导航,并为后续已确认模块保留扩展空间。
#### Scenario: Agent 管理路由激活
- **WHEN** 已登录用户打开 Agent 管理列表页
- **THEN** 后台框架将 `Agent管理` 显示为一级导航项
- **AND** 后台框架将 `Agent列表` 显示为其下的二级导航项
- **AND** `Agent列表` 使用主选中样式
- **AND** `Agent管理` 不使用主选中样式,只作为一级分组项展示
#### Scenario: 复用共享导航组件
- **WHEN** 后台框架渲染左侧导航
- **THEN** 后台框架通过共享 UI 导航组件渲染一级和二级菜单
- **AND** 后台框架 SHALL NOT 在页面内手写导航层级结构、选中态样式或展开交互
### Requirement: 左侧导航信息密度
岗位 Agent 管理后台 SHALL 使用适合桌面后台的左侧导航间距,并保证产品名称在默认桌面布局下不换行。
#### Scenario: 展示左侧导航
- **WHEN** 已登录用户在默认桌面宽度下查看后台框架
- **THEN** 左侧导航内边距保持紧凑,避免出现过大的顶部或左右留白
- **AND** 产品名称 `岗位Agent管理后台` 在左侧导航品牌区域保持单行展示
### Requirement: 默认受保护落点
岗位 Agent 管理后台 SHALL 将 Agent 管理列表页作为默认受保护落点。
#### Scenario: 已登录用户打开应用根路径
- **WHEN** 已登录用户打开应用根路径
- **THEN** 岗位 Agent 管理后台跳转到 Agent 管理列表页
#### Scenario: 登录成功且没有保存目标
- **WHEN** 登录成功且没有保存用户原本访问的受保护目标
- **THEN** 岗位 Agent 管理后台跳转到 Agent 管理列表页
### Requirement: 后台框架页面状态
岗位 Agent 管理后台 SHALL 在受保护页面展示加载中、空数据、筛选无结果或失败状态时,保持后台框架导航和退出登录可用。
#### Scenario: 页面数据加载失败
- **WHEN** Agent 管理列表页展示数据加载失败状态
- **THEN** 后台框架仍然可见
- **AND** 用户仍可导航或退出登录
# agent-management-list Specification
## Purpose
TBD - created by archiving change add-admin-login-agent-list-mock. Update Purpose after archive.
## Requirements
### Requirement: Agent 列表页结构
岗位 Agent 管理后台 SHALL 提供 Agent 管理列表页,包含标题、搜索与筛选控件、主操作区、表格和分页。
#### Scenario: 打开 Agent 列表页
- **WHEN** 已登录用户打开 Agent 管理列表页
- **THEN** Agent 管理列表页展示页面标题 `Agent管理`
- **AND** Agent 管理列表页展示 Agent 名称搜索框、所属岗位下拉框、状态下拉框、`搜索` 按钮、`重置` 按钮、表格和分页控件
### Requirement: Agent 列表查询控件
Agent 管理列表页 SHALL 允许用户按名称关键词、单个岗位和状态值 `全部`、`已上架`、`已停用` 查询 Agent。
#### Scenario: 提交关键词搜索
- **WHEN** 用户在 Agent 列表搜索控件中输入关键词并点击 `搜索`
- **THEN** Agent 管理列表页使用该关键词刷新列表
- **AND** Agent 管理列表页将分页行为保持为筛选结果第一页
#### Scenario: 切换岗位筛选
- **WHEN** 用户选择一个岗位筛选选项
- **THEN** Agent 管理列表页仅更新当前岗位筛选值
- **AND** Agent 管理列表页不会立即刷新列表
#### Scenario: 选择全部岗位
- **WHEN** 用户打开所属岗位下拉框
- **THEN** 下拉选项中包含 `全部` 选项
- **AND** 用户选择 `全部` 后,Agent 管理列表页取消岗位筛选
#### Scenario: 切换状态筛选
- **WHEN** 用户选择 `已上架` 或 `已停用`
- **THEN** Agent 管理列表页仅更新当前状态筛选值
- **AND** Agent 管理列表页不会立即刷新列表
#### Scenario: 提交筛选条件
- **WHEN** 用户已调整关键词、岗位或状态筛选值后点击 `搜索`
- **THEN** Agent 管理列表页使用当前表单中的关键词、岗位和状态条件刷新列表
- **AND** Agent 管理列表页将分页行为保持为筛选结果第一页
#### Scenario: 重置查询条件
- **WHEN** 用户在 Agent 列表页点击 `重置`
- **THEN** Agent 管理列表页清空关键词、所属岗位和状态筛选值
- **AND** Agent 管理列表页恢复默认查询条件并回到第 `1` 页
#### Scenario: 查询区字段与顺序
- **WHEN** 用户查看 Agent 列表查询区
- **THEN** 查询区按 `Agent名称`、`所属岗位`、`状态` 的顺序展示字段标签和对应控件
- **AND** 查询区采用左右结构,字段标签在左、输入/下拉控件在右
- **AND** 查询区在右侧操作区展示 `搜索` 按钮和 `重置` 按钮
### Requirement: 查询区容器语义
Agent 管理列表页 SHALL 使用普通布局容器承载 `所属岗位` 和 `状态` 下拉框,不通过原生 `label` 包裹下拉选择器。
#### Scenario: 打开查询区
- **WHEN** 用户查看 Agent 列表查询区
- **THEN** `所属岗位` 和 `状态` 下拉框外层使用普通容器
- **AND** 下拉框点击选项时不会因为外层原生 `label` 的激活行为重新打开控件
#### Scenario: 查询区控件宽度
- **WHEN** 用户查看 Agent 名称搜索框、所属岗位下拉框和状态下拉框
- **THEN** 三个控件宽度保持一致
- **AND** 每个控件宽度为 `200px`
#### Scenario: 岗位筛选不展示额外清空按钮
- **WHEN** 用户已经选择具体岗位
- **THEN** 所属岗位控件下方不展示额外的 `清空` 按钮
- **AND** 用户可通过重新选择 `全部` 或点击查询区 `重置` 按钮恢复默认筛选
#### Scenario: 选择后收起下拉框
- **WHEN** 用户在所属岗位或状态下拉框中选择某个选项
- **THEN** 当前下拉面板立即关闭
### Requirement: Agent 表格列
Agent 管理列表页 SHALL 为每条 Agent 列表数据展示 Agent 名称、所属岗位、状态、绑定群数、绑定 Skill 数、更新时间和行操作。
#### Scenario: 展示普通 Agent 行
- **WHEN** 列表包含非管家 Agent
- **THEN** 行内展示 Agent 名称、岗位标签、状态标签、绑定群数、绑定 Skill 数、更新时间和允许执行的操作
#### Scenario: 展示管家 Agent 行
- **WHEN** 列表包含管家 Agent
- **THEN** 行内岗位展示为 `系统调度`
- **AND** 行内不展示绑定 Skill 数值
### Requirement: 管家 Agent 展示与排序
Agent 管理列表页 SHALL 在页面数据包含管家 Agent 时保持其可见,并将其置于普通 Agent 之前。
#### Scenario: 正常列表数据包含管家 Agent
- **WHEN** Agent 列表数据同时包含管家 Agent 和普通 Agent
- **THEN** Agent 管理列表页将管家 Agent 展示在普通 Agent 之前
#### Scenario: 不存在普通 Agent
- **WHEN** 不存在普通 Agent
- **THEN** 只要 mock 或页面数据提供管家 Agent,Agent 管理列表页仍展示管家 Agent
### Requirement: Agent 状态展示
Agent 管理列表页 SHALL 将启用 Agent 展示为 `已上架`,将停用 Agent 展示为 `已停用`,并使用视觉上可区分的状态标签。
#### Scenario: 展示已上架 Agent 行
- **WHEN** Agent 列表项状态为 `enable`
- **THEN** Agent 管理列表页展示状态文案 `已上架`
#### Scenario: 展示已停用 Agent 行
- **WHEN** Agent 列表项状态为 `disable`
- **THEN** Agent 管理列表页展示状态文案 `已停用`
### Requirement: Agent 行操作
Agent 管理列表页 SHALL 按 Agent 类型和状态展示行操作。
#### Scenario: 管家 Agent 操作
- **WHEN** 行数据代表管家 Agent
- **THEN** Agent 管理列表页允许编辑
- **AND** Agent 管理列表页不允许停用、上架或删除
#### Scenario: 已上架普通 Agent 操作
- **WHEN** 行数据代表已上架的非管家 Agent
- **THEN** Agent 管理列表页允许编辑、停用和删除
- **AND** 停用和删除在执行前需要确认
#### Scenario: 已停用普通 Agent 操作
- **WHEN** 行数据代表已停用的非管家 Agent
- **THEN** Agent 管理列表页允许编辑、上架和删除
- **AND** 删除在执行前需要确认
### Requirement: 删除确认
Agent 管理列表页 SHALL 在删除非管家 Agent 前展示已确认的删除影响文案。
#### Scenario: 请求删除
- **WHEN** 用户请求删除 Agent `复盘Agent`
- **THEN** 确认框展示 `确认删除 Agent "复盘Agent"?`
- **AND** 确认框说明该 Agent 的企微员工会从所有已关联群中退出、官网展示配置会被清理、渠道活码 Agent 列表中不再出现该 Agent、关联的岗位标签不受影响
### Requirement: 页面状态
Agent 管理列表页 SHALL 提供加载中、正常数据、空数据、筛选无结果和失败状态。
#### Scenario: 列表加载中
- **WHEN** Agent 列表数据正在加载
- **THEN** Agent 管理列表页在不离开受保护后台框架的情况下展示加载中状态
#### Scenario: 筛选无结果
- **WHEN** 当前搜索或筛选条件没有匹配的普通 Agent 行
- **THEN** Agent 管理列表页展示筛选无结果状态,并允许用户调整或清空筛选
#### Scenario: 数据加载失败
- **WHEN** Agent 列表数据加载失败
- **THEN** Agent 管理列表页使用组件库 `StatePlaceholder` 的 `error` 语义展示可恢复的失败状态
- **AND** Agent 管理列表页提供重试操作
- **AND** Agent 管理列表页 SHALL NOT 使用“暂无数据”作为失败态主文案
### Requirement: Agent 列表分页展示
Agent 管理列表页 SHALL 根据列表总数和每页条数展示正确的分页页码。
#### Scenario: 总数不足一页
- **WHEN** 当前列表总数为 `6` 且每页条数为 `10`
- **THEN** Agent 管理列表页只展示 `1` 页
- **AND** Agent 管理列表页不得展示第 `2` 页
#### Scenario: 切换每页条数
- **WHEN** 用户在分页中选择新的 `每页条数`
- **THEN** Agent 管理列表页更新当前每页条数
- **AND** Agent 管理列表页回到第 `1` 页
- **AND** 列表结果随新的每页条数重新计算
### Requirement: Agent 列表最小 mock 契约
前端 mock 契约 SHALL 提供本列表切片需要的 mock 数据和页面契约字段,并且不要求后端实现细节。
#### Scenario: 消费 mock Agent 列表项
- **WHEN** Agent 列表页渲染 mock Agent 项
- **THEN** 该项包含 `agent_id`、`name`、`is_manager`、`positions`、`status`、`bound_group_count`、`bound_skill_count`、`updated_at` 和可用操作信息
#### Scenario: 消费 mock 岗位选项
- **WHEN** Agent 列表页渲染岗位筛选
- **THEN** mock 契约提供包含稳定 id 和展示名称字段的岗位选项
#### Scenario: 消费 mock 页面状态 fixtures
- **WHEN** 测试或本地开发需要列表页状态
- **THEN** mock 契约提供正常数据、空数据、筛选无结果、加载中、失败、长文本、不可用操作和分页边界场景 fixtures
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
"@types/node": "^25.0.1", "@types/node": "^25.0.1",
"@types/react": "^19.2.7", "@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"autoprefixer": "^10.5.0",
"jsdom": "^27.3.0", "jsdom": "^27.3.0",
"postcss": "^8.5.15",
"tailwindcss": "^3.4.17",
"vitest": "^4.0.15" "vitest": "^4.0.15"
} }
}, },
...@@ -39,6 +42,19 @@ ...@@ -39,6 +42,19 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@alloc/quick-lru": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
"integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@asamuzakjp/css-color": { "node_modules/@asamuzakjp/css-color": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-4.1.2.tgz", "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-4.1.2.tgz",
...@@ -986,6 +1002,44 @@ ...@@ -986,6 +1002,44 @@
"@jridgewell/sourcemap-codec": "^1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
} }
}, },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
"integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@nodelib/fs.stat": "2.0.5",
"run-parallel": "^1.1.9"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/@nodelib/fs.stat": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
"integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/@nodelib/fs.walk": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
"integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@nodelib/fs.scandir": "2.1.5",
"fastq": "^1.6.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/@rolldown/pluginutils": { "node_modules/@rolldown/pluginutils": {
"version": "1.0.0-rc.3", "version": "1.0.0-rc.3",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.3.tgz", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.3.tgz",
...@@ -1671,6 +1725,47 @@ ...@@ -1671,6 +1725,47 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
"integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",
"dev": true,
"license": "MIT"
},
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
"dev": true,
"license": "ISC",
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/anymatch/node_modules/picomatch": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/arg": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
"integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
"dev": true,
"license": "MIT"
},
"node_modules/aria-query": { "node_modules/aria-query": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
...@@ -1691,6 +1786,43 @@ ...@@ -1691,6 +1786,43 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/autoprefixer": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.5.0.tgz",
"integrity": "sha512-FMhOoZV4+qR6aTUALKX2rEqGG+oyATvwBt9IIzVR5rMa2HRWPkxf+P+PAJLD1I/H5/II+HuZcBJYEFBpq39ong==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/autoprefixer"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"browserslist": "^4.28.2",
"caniuse-lite": "^1.0.30001787",
"fraction.js": "^5.3.4",
"picocolors": "^1.1.1",
"postcss-value-parser": "^4.2.0"
},
"bin": {
"autoprefixer": "bin/autoprefixer"
},
"engines": {
"node": "^10 || ^12 || >=14"
},
"peerDependencies": {
"postcss": "^8.1.0"
}
},
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.10.29", "version": "2.10.29",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.29.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.29.tgz",
...@@ -1713,6 +1845,32 @@ ...@@ -1713,6 +1845,32 @@
"require-from-string": "^2.0.2" "require-from-string": "^2.0.2"
} }
}, },
"node_modules/binary-extensions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"license": "MIT",
"dependencies": {
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.28.2", "version": "4.28.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz",
...@@ -1746,6 +1904,16 @@ ...@@ -1746,6 +1904,16 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
} }
}, },
"node_modules/camelcase-css": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz",
"integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 6"
}
},
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001792", "version": "1.0.30001792",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001792.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001792.tgz",
...@@ -1776,6 +1944,54 @@ ...@@ -1776,6 +1944,54 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"dev": true,
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/chokidar/node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
"integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 6"
}
},
"node_modules/convert-source-map": { "node_modules/convert-source-map": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
...@@ -1816,6 +2032,19 @@ ...@@ -1816,6 +2032,19 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/cssesc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
"integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
"dev": true,
"license": "MIT",
"bin": {
"cssesc": "bin/cssesc"
},
"engines": {
"node": ">=4"
}
},
"node_modules/cssstyle": { "node_modules/cssstyle": {
"version": "5.3.7", "version": "5.3.7",
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-5.3.7.tgz", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-5.3.7.tgz",
...@@ -1907,6 +2136,20 @@ ...@@ -1907,6 +2136,20 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/didyoumean": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/dlv": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
"integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==",
"dev": true,
"license": "MIT"
},
"node_modules/dom-accessibility-api": { "node_modules/dom-accessibility-api": {
"version": "0.5.16", "version": "0.5.16",
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
...@@ -1934,6 +2177,16 @@ ...@@ -1934,6 +2177,16 @@
"url": "https://github.com/fb55/entities?sponsor=1" "url": "https://github.com/fb55/entities?sponsor=1"
} }
}, },
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-module-lexer": { "node_modules/es-module-lexer": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz",
...@@ -2011,6 +2264,46 @@ ...@@ -2011,6 +2264,46 @@
"node": ">=12.0.0" "node": ">=12.0.0"
} }
}, },
"node_modules/fast-glob": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
"integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
"merge2": "^1.3.0",
"micromatch": "^4.0.8"
},
"engines": {
"node": ">=8.6.0"
}
},
"node_modules/fast-glob/node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fastq": {
"version": "1.20.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",
"integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",
"dev": true,
"license": "ISC",
"dependencies": {
"reusify": "^1.0.4"
}
},
"node_modules/fdir": { "node_modules/fdir": {
"version": "6.5.0", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
...@@ -2028,6 +2321,33 @@ ...@@ -2028,6 +2321,33 @@
} }
} }
}, },
"node_modules/fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"license": "MIT",
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/fraction.js": {
"version": "5.3.4",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz",
"integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": "*"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/rawify"
}
},
"node_modules/fsevents": { "node_modules/fsevents": {
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
...@@ -2042,6 +2362,16 @@ ...@@ -2042,6 +2362,16 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0" "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
} }
}, },
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/gensync": { "node_modules/gensync": {
"version": "1.0.0-beta.2", "version": "1.0.0-beta.2",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
...@@ -2051,6 +2381,32 @@ ...@@ -2051,6 +2381,32 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.3"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/hasown": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz",
"integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==",
"dev": true,
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/html-encoding-sniffer": { "node_modules/html-encoding-sniffer": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz",
...@@ -2102,6 +2458,68 @@ ...@@ -2102,6 +2458,68 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"license": "MIT",
"dependencies": {
"binary-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-core-module": {
"version": "2.16.2",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz",
"integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==",
"dev": true,
"license": "MIT",
"dependencies": {
"hasown": "^2.0.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/is-potential-custom-element-name": { "node_modules/is-potential-custom-element-name": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
...@@ -2109,6 +2527,16 @@ ...@@ -2109,6 +2527,16 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/jiti": {
"version": "1.21.7",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz",
"integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",
"devOptional": true,
"license": "MIT",
"bin": {
"jiti": "bin/jiti.js"
}
},
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
...@@ -2179,6 +2607,26 @@ ...@@ -2179,6 +2607,26 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/lilconfig": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
"integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/antonk52"
}
},
"node_modules/lines-and-columns": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
"dev": true,
"license": "MIT"
},
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
...@@ -2216,8 +2664,45 @@ ...@@ -2216,8 +2664,45 @@
"dev": true, "dev": true,
"license": "CC0-1.0" "license": "CC0-1.0"
}, },
"node_modules/min-indent": { "node_modules/merge2": {
"version": "1.0.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/micromatch": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
"license": "MIT",
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=8.6"
}
},
"node_modules/micromatch/node_modules/picomatch": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/min-indent": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
"integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
"dev": true, "dev": true,
...@@ -2232,6 +2717,18 @@ ...@@ -2232,6 +2717,18 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/mz": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
"integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"any-promise": "^1.0.0",
"object-assign": "^4.0.1",
"thenify-all": "^1.0.0"
}
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.12", "version": "3.3.12",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",
...@@ -2256,6 +2753,36 @@ ...@@ -2256,6 +2753,36 @@
"integrity": "sha512-5WUyunoPMsvvEhS8AxHtRzP+oA8UCkJ7YRxatWKjngndhDGLiqEVAQKWjFAiAiuL8zMRGzGSJxFnLetoa43qGQ==", "integrity": "sha512-5WUyunoPMsvvEhS8AxHtRzP+oA8UCkJ7YRxatWKjngndhDGLiqEVAQKWjFAiAiuL8zMRGzGSJxFnLetoa43qGQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/object-hash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz",
"integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 6"
}
},
"node_modules/obug": { "node_modules/obug": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz",
...@@ -2280,6 +2807,13 @@ ...@@ -2280,6 +2807,13 @@
"url": "https://github.com/inikulin/parse5?sponsor=1" "url": "https://github.com/inikulin/parse5?sponsor=1"
} }
}, },
"node_modules/path-parse": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true,
"license": "MIT"
},
"node_modules/pathe": { "node_modules/pathe": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
...@@ -2305,10 +2839,30 @@ ...@@ -2305,10 +2839,30 @@
"url": "https://github.com/sponsors/jonschlinkert" "url": "https://github.com/sponsors/jonschlinkert"
} }
}, },
"node_modules/pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/pirates": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
"integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 6"
}
},
"node_modules/postcss": { "node_modules/postcss": {
"version": "8.5.14", "version": "8.5.15",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.14.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",
"integrity": "sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg==", "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
...@@ -2325,7 +2879,7 @@ ...@@ -2325,7 +2879,7 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"nanoid": "^3.3.11", "nanoid": "^3.3.12",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
"source-map-js": "^1.2.1" "source-map-js": "^1.2.1"
}, },
...@@ -2333,6 +2887,133 @@ ...@@ -2333,6 +2887,133 @@
"node": "^10 || ^12 || >=14" "node": "^10 || ^12 || >=14"
} }
}, },
"node_modules/postcss-import": {
"version": "15.1.0",
"resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz",
"integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==",
"dev": true,
"license": "MIT",
"dependencies": {
"postcss-value-parser": "^4.0.0",
"read-cache": "^1.0.0",
"resolve": "^1.1.7"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"postcss": "^8.0.0"
}
},
"node_modules/postcss-js": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz",
"integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"camelcase-css": "^2.0.1"
},
"engines": {
"node": "^12 || ^14 || >= 16"
},
"peerDependencies": {
"postcss": "^8.4.21"
}
},
"node_modules/postcss-load-config": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz",
"integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"lilconfig": "^3.0.0",
"yaml": "^2.3.4"
},
"engines": {
"node": ">= 14"
},
"peerDependencies": {
"postcss": ">=8.0.9",
"ts-node": ">=9.0.0"
},
"peerDependenciesMeta": {
"postcss": {
"optional": true
},
"ts-node": {
"optional": true
}
}
},
"node_modules/postcss-nested": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz",
"integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"postcss-selector-parser": "^6.1.1"
},
"engines": {
"node": ">=12.0"
},
"peerDependencies": {
"postcss": "^8.2.14"
}
},
"node_modules/postcss-selector-parser": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz",
"integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==",
"dev": true,
"license": "MIT",
"dependencies": {
"cssesc": "^3.0.0",
"util-deprecate": "^1.0.2"
},
"engines": {
"node": ">=4"
}
},
"node_modules/postcss-value-parser": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
"dev": true,
"license": "MIT"
},
"node_modules/pretty-format": { "node_modules/pretty-format": {
"version": "27.5.1", "version": "27.5.1",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
...@@ -2359,6 +3040,27 @@ ...@@ -2359,6 +3040,27 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/react": { "node_modules/react": {
"version": "19.2.6", "version": "19.2.6",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz",
...@@ -2435,6 +3137,42 @@ ...@@ -2435,6 +3137,42 @@
"react-dom": ">=18" "react-dom": ">=18"
} }
}, },
"node_modules/read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
"integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"pify": "^2.3.0"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/readdirp/node_modules/picomatch": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/redent": { "node_modules/redent": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
...@@ -2459,6 +3197,39 @@ ...@@ -2459,6 +3197,39 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/resolve": {
"version": "1.22.12",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz",
"integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"is-core-module": "^2.16.1",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
"bin": {
"resolve": "bin/resolve"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/reusify": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
"integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
"dev": true,
"license": "MIT",
"engines": {
"iojs": ">=1.0.0",
"node": ">=0.10.0"
}
},
"node_modules/rollup": { "node_modules/rollup": {
"version": "4.60.4", "version": "4.60.4",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.4.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.4.tgz",
...@@ -2503,6 +3274,30 @@ ...@@ -2503,6 +3274,30 @@
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
"integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"queue-microtask": "^1.2.2"
}
},
"node_modules/saxes": { "node_modules/saxes": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
...@@ -2580,6 +3375,42 @@ ...@@ -2580,6 +3375,42 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/sucrase": {
"version": "3.35.1",
"resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz",
"integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.2",
"commander": "^4.0.0",
"lines-and-columns": "^1.1.6",
"mz": "^2.7.0",
"pirates": "^4.0.1",
"tinyglobby": "^0.2.11",
"ts-interface-checker": "^0.1.9"
},
"bin": {
"sucrase": "bin/sucrase",
"sucrase-node": "bin/sucrase-node"
},
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/symbol-tree": { "node_modules/symbol-tree": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
...@@ -2587,6 +3418,67 @@ ...@@ -2587,6 +3418,67 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/tailwindcss": {
"version": "3.4.17",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz",
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
"dev": true,
"license": "MIT",
"dependencies": {
"@alloc/quick-lru": "^5.2.0",
"arg": "^5.0.2",
"chokidar": "^3.6.0",
"didyoumean": "^1.2.2",
"dlv": "^1.1.3",
"fast-glob": "^3.3.2",
"glob-parent": "^6.0.2",
"is-glob": "^4.0.3",
"jiti": "^1.21.6",
"lilconfig": "^3.1.3",
"micromatch": "^4.0.8",
"normalize-path": "^3.0.0",
"object-hash": "^3.0.0",
"picocolors": "^1.1.1",
"postcss": "^8.4.47",
"postcss-import": "^15.1.0",
"postcss-js": "^4.0.1",
"postcss-load-config": "^4.0.2",
"postcss-nested": "^6.2.0",
"postcss-selector-parser": "^6.1.2",
"resolve": "^1.22.8",
"sucrase": "^3.35.0"
},
"bin": {
"tailwind": "lib/cli.js",
"tailwindcss": "lib/cli.js"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/thenify": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
"integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
"dev": true,
"license": "MIT",
"dependencies": {
"any-promise": "^1.0.0"
}
},
"node_modules/thenify-all": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
"integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",
"dev": true,
"license": "MIT",
"dependencies": {
"thenify": ">= 3.1.0 < 4"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/tinybench": { "node_modules/tinybench": {
"version": "2.9.0", "version": "2.9.0",
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
...@@ -2650,6 +3542,19 @@ ...@@ -2650,6 +3542,19 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/tough-cookie": { "node_modules/tough-cookie": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.1.tgz", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.1.tgz",
...@@ -2676,6 +3581,13 @@ ...@@ -2676,6 +3581,13 @@
"node": ">=20" "node": ">=20"
} }
}, },
"node_modules/ts-interface-checker": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.9.3", "version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
...@@ -2726,6 +3638,13 @@ ...@@ -2726,6 +3638,13 @@
"browserslist": ">= 4.21.0" "browserslist": ">= 4.21.0"
} }
}, },
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"dev": true,
"license": "MIT"
},
"node_modules/vite": { "node_modules/vite": {
"version": "7.3.3", "version": "7.3.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.3.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.3.tgz",
...@@ -2998,6 +3917,22 @@ ...@@ -2998,6 +3917,22 @@
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"license": "ISC" "license": "ISC"
},
"node_modules/yaml": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
"integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
"devOptional": true,
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14.6"
},
"funding": {
"url": "https://github.com/sponsors/eemeli"
}
} }
} }
} }
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
}, },
"dependencies": { "dependencies": {
"@vitejs/plugin-react": "^5.1.2", "@vitejs/plugin-react": "^5.1.2",
"vite": "^7.3.0",
"typescript": "^5.9.3",
"react": "^19.2.3", "react": "^19.2.3",
"react-dom": "^19.2.3", "react-dom": "^19.2.3",
"react-router-dom": "^7.10.1" "react-router-dom": "^7.10.1",
"typescript": "^5.9.3",
"vite": "^7.3.0"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/jest-dom": "^6.9.1", "@testing-library/jest-dom": "^6.9.1",
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
"@types/node": "^25.0.1", "@types/node": "^25.0.1",
"@types/react": "^19.2.7", "@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"autoprefixer": "^10.5.0",
"jsdom": "^27.3.0", "jsdom": "^27.3.0",
"postcss": "^8.5.15",
"tailwindcss": "^3.4.17",
"vitest": "^4.0.15" "vitest": "^4.0.15"
} }
} }
import { describe, expect, it } from 'vitest';
import {
agentListMockFixtures,
agentPositionOptions,
getAgentListPage,
sortAgentsForDisplay,
} from './agent-list-mock';
describe('agent list mock contract', () => {
it('provides the minimal page-facing fields and stable position options', () => {
const [agent] = agentListMockFixtures.normal.items;
expect(agent).toMatchObject({
agent_id: expect.any(Number),
name: expect.any(String),
is_manager: expect.any(Boolean),
positions: expect.any(Array),
status: expect.stringMatching(/enable|disable/),
bound_group_count: expect.any(Number),
bound_skill_count: expect.any(Number),
updated_at: expect.any(String),
available_actions: expect.any(Array),
});
expect(agentPositionOptions[0]).toEqual({ id: 'sales', name: '驻店销售岗' });
});
it('covers required page state fixtures without a backend service', () => {
expect(Object.keys(agentListMockFixtures).sort()).toEqual([
'disabledActions',
'empty',
'error',
'filteredEmpty',
'loading',
'longText',
'managerOnly',
'normal',
'paginationBoundary',
]);
});
it('keeps manager agents visible and sorted before ordinary agents', () => {
const sorted = sortAgentsForDisplay(agentListMockFixtures.normal.items);
expect(sorted[0].is_manager).toBe(true);
expect(sorted[0].positions).toEqual([]);
});
it('filters and paginates mock data from page-facing query fields', () => {
const result = getAgentListPage({ keyword: '复盘', positionId: 'sales', status: 'enable', page: 1, pageSize: 10 });
expect(result.total).toBe(1);
expect(result.items[0].name).toBe('复盘Agent');
});
});
export type AgentStatus = 'enable' | 'disable';
export type AgentAction = 'edit' | 'enable' | 'disable' | 'delete';
export interface AgentPositionOption {
id: string;
name: string;
}
export interface AgentListMockItem extends Record<string, unknown> {
agent_id: number;
name: string;
is_manager: boolean;
positions: AgentPositionOption[];
status: AgentStatus;
bound_group_count: number;
bound_skill_count: number;
updated_at: string;
available_actions: AgentAction[];
}
export interface AgentListMockFixture {
loading?: boolean;
error?: boolean;
items: AgentListMockItem[];
total?: number;
}
export interface AgentListPageQuery {
keyword?: string;
positionId?: string;
status?: AgentStatus | 'all';
page: number;
pageSize: number;
source?: AgentListMockItem[];
}
export const agentPositionOptions: AgentPositionOption[] = [
{ id: 'sales', name: '驻店销售岗' },
{ id: 'service', name: '客服岗' },
{ id: 'ops', name: '运营岗' },
];
const managerAgent: AgentListMockItem = {
agent_id: 1,
name: '管家Agent',
is_manager: true,
positions: [],
status: 'enable',
bound_group_count: 12,
bound_skill_count: 0,
updated_at: '2026-05-19 10:30:00',
available_actions: ['edit'],
};
const normalAgents: AgentListMockItem[] = [
{
agent_id: 101,
name: '复盘Agent',
is_manager: false,
positions: [agentPositionOptions[0]],
status: 'enable',
bound_group_count: 8,
bound_skill_count: 4,
updated_at: '2026-05-18 16:20:00',
available_actions: ['edit', 'disable', 'delete'],
},
{
agent_id: 102,
name: '质检Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 3,
bound_skill_count: 2,
updated_at: '2026-05-17 09:15:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 103,
name: '销售助手Agent',
is_manager: false,
positions: [agentPositionOptions[0], agentPositionOptions[2]],
status: 'enable',
bound_group_count: 15,
bound_skill_count: 6,
updated_at: '2026-05-16 13:05:00',
available_actions: ['edit', 'disable', 'delete'],
},
{
agent_id: 104,
name: '线索跟进Agent',
is_manager: false,
positions: [agentPositionOptions[2]],
status: 'enable',
bound_group_count: 5,
bound_skill_count: 3,
updated_at: '2026-05-15 18:40:00',
available_actions: ['edit', 'disable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
{
agent_id: 105,
name: '客诉安抚Agent',
is_manager: false,
positions: [agentPositionOptions[1]],
status: 'disable',
bound_group_count: 1,
bound_skill_count: 1,
updated_at: '2026-05-14 11:25:00',
available_actions: ['edit', 'enable', 'delete'],
},
];
export const agentListMockFixtures = {
normal: { items: [managerAgent, ...normalAgents], total: 6 },
managerOnly: { items: [managerAgent], total: 1 },
empty: { items: [], total: 0 },
filteredEmpty: { items: [], total: 0 },
loading: { loading: true, items: [] },
error: { error: true, items: [] },
longText: {
items: [
{
...normalAgents[0],
agent_id: 201,
name: '超长名称用于验证表格截断和换行规则的复盘Agent',
updated_at: '2026-05-13 08:00:00',
},
],
total: 1,
},
disabledActions: { items: [{ ...managerAgent, available_actions: ['edit'] }], total: 1 },
paginationBoundary: { items: [managerAgent, ...normalAgents], total: 51 },
} satisfies Record<string, AgentListMockFixture>;
export function sortAgentsForDisplay(items: AgentListMockItem[]) {
return [...items].sort((left, right) => Number(right.is_manager) - Number(left.is_manager));
}
export function getAgentListPage({ keyword = '', page, pageSize, positionId, source, status = 'all' }: AgentListPageQuery) {
const normalizedKeyword = keyword.trim().toLowerCase();
const filtered = sortAgentsForDisplay(source ?? agentListMockFixtures.normal.items).filter((agent) => {
const matchesKeyword = !normalizedKeyword || agent.name.toLowerCase().includes(normalizedKeyword);
const matchesPosition = !positionId || agent.positions.some((position) => position.id === positionId);
const matchesStatus = status === 'all' || agent.status === status;
return matchesKeyword && matchesPosition && matchesStatus;
});
const start = (page - 1) * pageSize;
return {
items: filtered.slice(start, start + pageSize),
page,
pageSize,
total: filtered.length,
};
}
...@@ -134,6 +134,66 @@ type JobTagOption = Pick<JobTagListItem, "tag_id" | "name" | "code">; ...@@ -134,6 +134,66 @@ type JobTagOption = Pick<JobTagListItem, "tag_id" | "name" | "code">;
### 4.1 Agent 列表 ### 4.1 Agent 列表
#### 4.1.1 本期前端 mock 最小契约
`add-admin-login-agent-list-mock` 切片在没有后端接口的情况下,先使用前端本地 mock 数据驱动 Agent 管理列表页。该 mock 契约只覆盖当前列表页、筛选控件、分页和行操作需要的页面字段,不约束后端存储、鉴权、运行时 Agent 能力或真实接口字段。
```ts
type AgentStatus = "enable" | "disable";
type AgentAction = "edit" | "enable" | "disable" | "delete";
interface AgentPositionOption {
/** 稳定岗位选项 ID,用于前端筛选。 */
id: string;
/** 岗位展示名称。 */
name: string;
}
interface AgentListMockItem {
/** Agent 标识。 */
agent_id: number;
/** Agent 展示名称。 */
name: string;
/** 是否为管家 Agent。 */
is_manager: boolean;
/** 普通 Agent 的岗位列表;管家 Agent 前端固定展示为「系统调度」。 */
positions: AgentPositionOption[];
/** Agent 状态。 */
status: AgentStatus;
/** 已绑定群数量。 */
bound_group_count: number;
/** 已绑定 Skill 数量;管家 Agent 列表展示为 `-`。 */
bound_skill_count: number;
/** 更新时间展示字符串。 */
updated_at: string;
/** 当前行可展示的操作。 */
available_actions: AgentAction[];
}
```
本期 fixture 至少覆盖:
| fixture | 场景 |
|-|-|
| `normal` | 正常列表,包含管家 Agent 和普通 Agent。 |
| `managerOnly` | 仅管家 Agent。 |
| `empty` | 初始无数据。 |
| `filteredEmpty` | 筛选无结果。 |
| `loading` | 列表加载中。 |
| `error` | 列表加载失败。 |
| `longText` | 长文本列表项。 |
| `disabledActions` | 不可用操作或受限操作。 |
| `paginationBoundary` | 分页边界。 |
页面规则:
- 管家 Agent 必须保持可见,并排序在普通 Agent 之前。
- 管家 Agent 岗位展示为「系统调度」,不展示绑定 Skill 数值。
- 失败态使用 `StatePlaceholder state="error"`,不得用“暂无数据”作为主文案。
- 删除普通 Agent 前展示确认文案:该 Agent 的企微员工会从所有已关联群中退出、官网展示配置会被清理、渠道活码 Agent 列表中不再出现该 Agent、关联的岗位标签不受影响。
#### 4.1.2 后续接口草案
`GET /api/v1/agents` `GET /api/v1/agents`
查询参数: 查询参数:
......
...@@ -11,6 +11,69 @@ export interface TabsItem { ...@@ -11,6 +11,69 @@ export interface TabsItem {
children?: ReactNode; children?: ReactNode;
} }
export interface NavigationItem {
key: string;
label: ReactNode;
disabled?: boolean;
children?: NavigationItem[];
}
export interface NavigationProps {
/** Navigation 通过受控 activeKey 承载后台层级菜单,业务侧只传配置和路由状态。 */
activeKey?: string;
items: NavigationItem[];
ariaLabel?: string;
onChange?: (key: string) => void;
}
export function Navigation({ activeKey, ariaLabel = '导航', items, onChange }: NavigationProps) {
return (
<nav className={styles.navigation} aria-label={ariaLabel}>
{items.map((item) => {
const hasChildren = Boolean(item.children?.length);
const parentActive = hasChildren && item.children?.some((child) => child.key === activeKey);
return (
<div key={item.key} className={styles.navigationGroup}>
<button
className={styles.navigationItem}
data-active-parent={parentActive ? 'true' : undefined}
disabled={item.disabled}
type="button"
onClick={() => {
if (!item.disabled) onChange?.(item.key);
}}
>
{item.label}
</button>
{hasChildren ? (
<div className={styles.navigationChildren}>
{item.children?.map((child) => {
const selected = child.key === activeKey;
return (
<button
key={child.key}
className={cx(styles.navigationItem, styles.navigationChild, selected && styles.navigationItemActive)}
aria-current={selected ? 'page' : undefined}
disabled={child.disabled}
type="button"
onClick={() => {
if (!child.disabled) onChange?.(child.key);
}}
>
{child.label}
</button>
);
})}
</div>
) : null}
</div>
);
})}
</nav>
);
}
export interface TabsProps { export interface TabsProps {
/** Tabs 采用受控 activeKey,切换只通过 onChange 通知业务侧。 */ /** Tabs 采用受控 activeKey,切换只通过 onChange 通知业务侧。 */
activeKey: string; activeKey: string;
...@@ -109,6 +172,46 @@ export function Empty({ action, description = '暂无数据' }: EmptyProps) { ...@@ -109,6 +172,46 @@ export function Empty({ action, description = '暂无数据' }: EmptyProps) {
return <div className={styles.stack}><div className={styles.muted}>{description}</div>{action}</div>; return <div className={styles.stack}><div className={styles.muted}>{description}</div>{action}</div>;
} }
export interface StatePlaceholderProps {
/** StatePlaceholder 表达内容区状态;失败态明确区别于空数据,不使用“暂无数据”兜底。 */
state: 'empty' | 'filtered-empty' | 'error' | 'forbidden' | 'offline';
title?: ReactNode;
description?: ReactNode;
primaryAction?: ReactNode;
secondaryAction?: ReactNode;
icon?: ReactNode;
}
const stateDefaults: Record<StatePlaceholderProps['state'], { title: string; description: string; role: 'status' | 'alert'; icon: ReactNode }> = {
empty: { title: '暂无数据', description: '当前内容为空', role: 'status', icon: <Icon name="file" /> },
'filtered-empty': { title: '未找到匹配结果', description: '请调整搜索或筛选条件', role: 'status', icon: <Icon name="search" /> },
error: { title: '加载失败', description: '数据请求失败,请稍后重试', role: 'alert', icon: <Icon name="warning-circle" /> },
forbidden: { title: '权限受限', description: '当前账号暂无访问权限', role: 'alert', icon: <Icon name="close-circle" /> },
offline: { title: '网络不可用', description: '请检查网络连接后重试', role: 'alert', icon: <Icon name="refresh" /> },
};
const stateClassNames: Record<StatePlaceholderProps['state'], string | undefined> = {
empty: undefined,
'filtered-empty': styles.statePlaceholderFiltered,
error: styles.statePlaceholderError,
forbidden: styles.statePlaceholderForbidden,
offline: styles.statePlaceholderOffline,
};
export function StatePlaceholder({ description, icon, primaryAction, secondaryAction, state, title }: StatePlaceholderProps) {
const defaults = stateDefaults[state];
const resolvedTitle = title ?? defaults.title;
return (
<div className={cx(styles.statePlaceholder, stateClassNames[state])} role={defaults.role} aria-label={String(resolvedTitle)}>
<div className={styles.statePlaceholderIcon} aria-hidden="true">{icon ?? defaults.icon}</div>
<strong className={styles.statePlaceholderTitle}>{resolvedTitle}</strong>
<div className={styles.muted}>{description ?? defaults.description}</div>
{(primaryAction || secondaryAction) ? <div className={styles.statePlaceholderActions}>{primaryAction}{secondaryAction}</div> : null}
</div>
);
}
export function Skeleton({ active = false }: { active?: boolean }) { export function Skeleton({ active = false }: { active?: boolean }) {
return <div aria-label="加载占位" className={cx(styles.skeleton, active && styles.stack)} style={{ width: '100%', height: 16 }} />; return <div aria-label="加载占位" className={cx(styles.skeleton, active && styles.stack)} style={{ width: '100%', height: 16 }} />;
} }
......
import { useState } from 'react'; import { useState } from 'react';
import styles from './Shared.module.css'; import styles from './Shared.module.css';
import { cx } from './utils';
export interface PaginationProps { export interface PaginationProps {
/** current/pageSize/total 共同描述后台列表分页状态。 */ /** current/pageSize/total 共同描述后台列表分页状态。 */
...@@ -15,13 +16,14 @@ export function Pagination({ current, pageSize, pageSizeOptions = [10, 20, 50], ...@@ -15,13 +16,14 @@ export function Pagination({ current, pageSize, pageSizeOptions = [10, 20, 50],
const [jump, setJump] = useState(''); const [jump, setJump] = useState('');
const totalPages = Math.max(1, Math.ceil(total / pageSize)); const totalPages = Math.max(1, Math.ceil(total / pageSize));
const pages = Array.from({ length: Math.min(totalPages, 5) }, (_, index) => index + 1); const pages = Array.from({ length: Math.min(totalPages, 5) }, (_, index) => index + 1);
const submitJump = () => onChange?.(Number(jump), pageSize);
return ( return (
<div className={styles.between}> <div className={styles.between}>
<span className={styles.muted}>共 {total} 条</span> <span className={styles.muted}>共 {total} 条</span>
<div className={styles.row}> <div className={styles.row}>
{pages.map((page) => ( {pages.map((page) => (
<button key={page} className={styles.control} type="button" aria-label={`第 ${page} 页`} aria-current={page === current ? 'page' : undefined} onClick={() => onChange?.(page, pageSize)}> <button key={page} className={cx(styles.control, page === current && styles.paginationCurrent)} type="button" aria-label={`第 ${page} 页`} aria-current={page === current ? 'page' : undefined} onClick={() => onChange?.(page, pageSize)}>
{page} {page}
</button> </button>
))} ))}
...@@ -32,8 +34,16 @@ export function Pagination({ current, pageSize, pageSizeOptions = [10, 20, 50], ...@@ -32,8 +34,16 @@ export function Pagination({ current, pageSize, pageSizeOptions = [10, 20, 50],
</option> </option>
))} ))}
</select> </select>
<input aria-label="跳至页码" className={styles.control} value={jump} onChange={(event) => setJump(event.target.value)} /> <input
<button className={styles.control} type="button" onClick={() => onChange?.(Number(jump), pageSize)}> aria-label="跳至页码"
className={styles.control}
value={jump}
onChange={(event) => setJump(event.target.value)}
onKeyDown={(event) => {
if (event.key === 'Enter') submitJump();
}}
/>
<button className={styles.control} type="button" onClick={submitJump}>
跳转 跳转
</button> </button>
</div> </div>
......
...@@ -22,16 +22,18 @@ export interface SelectProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement ...@@ -22,16 +22,18 @@ export interface SelectProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
onChange?: (value: string | undefined, option: SelectOption | undefined) => void; onChange?: (value: string | undefined, option: SelectOption | undefined) => void;
} }
export function Select({ allowClear, options, placeholder = '请选择', value, onChange, ...props }: SelectProps) { export function Select(props: SelectProps) {
const { allowClear, options, placeholder = '请选择', value, onChange, ...buttonProps } = props;
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const popupId = useExclusivePopup(selectPopupOpenEvent, setOpen); const popupId = useExclusivePopup(selectPopupOpenEvent, setOpen);
const [innerValue, setInnerValue] = useState<string | undefined>(value); const isControlled = Object.prototype.hasOwnProperty.call(props, 'value');
const currentValue = value ?? innerValue; const [innerValue, setInnerValue] = useState<string | undefined>(undefined);
const currentValue = isControlled ? value : innerValue;
const currentOption = options.find((option) => option.value === currentValue); const currentOption = options.find((option) => option.value === currentValue);
const label = props['aria-label'] ?? '选择框'; const label = buttonProps['aria-label'] ?? '选择框';
const commit = (nextValue: string | undefined, option: SelectOption | undefined) => { const commit = (nextValue: string | undefined, option: SelectOption | undefined) => {
if (value === undefined) { if (!isControlled) {
setInnerValue(nextValue); setInnerValue(nextValue);
} }
onChange?.(nextValue, option); onChange?.(nextValue, option);
...@@ -47,7 +49,7 @@ export function Select({ allowClear, options, placeholder = '请选择', value, ...@@ -47,7 +49,7 @@ export function Select({ allowClear, options, placeholder = '请选择', value,
return ( return (
<span className={styles.selectWrapper}> <span className={styles.selectWrapper}>
<button {...props} className={cx(styles.control, styles.fieldButton)} role="combobox" aria-expanded={open} type="button" onClick={toggleOpen}> <button {...buttonProps} className={cx(styles.control, styles.fieldButton)} role="combobox" aria-expanded={open} type="button" onClick={toggleOpen}>
<span>{currentOption?.label ?? placeholder}</span> <span>{currentOption?.label ?? placeholder}</span>
<Icon className={styles.fieldIcon} name={open ? 'chevron-down' : 'chevron-right'} /> <Icon className={styles.fieldIcon} name={open ? 'chevron-down' : 'chevron-right'} />
</button> </button>
......
...@@ -7,6 +7,13 @@ ...@@ -7,6 +7,13 @@
font-size: var(--gl-font-size-sm); font-size: var(--gl-font-size-sm);
} }
.paginationCurrent {
border-color: var(--gl-color-primary);
background: color-mix(in srgb, var(--gl-color-primary) 10%, #fff);
color: var(--gl-color-primary);
font-weight: 600;
}
.fieldButton { .fieldButton {
display: inline-flex; display: inline-flex;
width: 100%; width: 100%;
...@@ -316,6 +323,59 @@ ...@@ -316,6 +323,59 @@
gap: var(--gl-spacing-sm); gap: var(--gl-spacing-sm);
} }
.navigation {
display: grid;
gap: var(--gl-spacing-sm);
}
.navigationGroup {
display: grid;
gap: 6px;
}
.navigationChildren {
display: grid;
gap: 4px;
padding-left: var(--gl-spacing-sm);
}
.navigationItem {
display: inline-flex;
min-height: 36px;
width: 100%;
align-items: center;
border: 0;
border-radius: var(--gl-radius-md);
background: transparent;
color: var(--gl-color-text-secondary);
cursor: pointer;
font: inherit;
font-size: var(--gl-font-size-sm);
text-align: left;
transition: background 0.15s ease, color 0.15s ease;
padding: 0 var(--gl-spacing-md);
}
.navigationItem:hover:not(:disabled) {
background: var(--gl-color-fill-hover);
color: var(--gl-color-text-primary);
}
.navigationItem:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.navigationItemActive {
background: color-mix(in srgb, var(--gl-color-primary) 12%, #fff);
color: var(--gl-color-primary);
font-weight: 600;
}
.navigationChild {
min-height: 34px;
}
.form { .form {
display: grid; display: grid;
width: 100%; width: 100%;
...@@ -621,6 +681,55 @@ ...@@ -621,6 +681,55 @@
color: var(--gl-color-primary); color: var(--gl-color-primary);
} }
.statePlaceholder {
display: grid;
justify-items: center;
gap: var(--gl-spacing-sm);
min-height: 132px;
padding: var(--gl-spacing-xl);
color: var(--gl-color-text-primary);
text-align: center;
}
.statePlaceholderIcon {
display: inline-grid;
width: 40px;
height: 40px;
place-items: center;
border-radius: 50%;
background: color-mix(in srgb, var(--gl-color-primary) 10%, #fff);
color: var(--gl-color-primary);
}
.statePlaceholderTitle {
font-size: var(--gl-font-size-md);
line-height: var(--gl-line-height-lg);
}
.statePlaceholderActions {
display: inline-flex;
flex-wrap: wrap;
justify-content: center;
gap: var(--gl-spacing-sm);
margin-top: var(--gl-spacing-xs);
}
.statePlaceholderFiltered .statePlaceholderIcon {
background: color-mix(in srgb, var(--gl-color-warning, #dc6803) 10%, #fff);
color: var(--gl-color-warning, #dc6803);
}
.statePlaceholderError .statePlaceholderIcon,
.statePlaceholderForbidden .statePlaceholderIcon {
background: color-mix(in srgb, var(--gl-color-danger, #d92d20) 10%, #fff);
color: var(--gl-color-danger, #d92d20);
}
.statePlaceholderOffline .statePlaceholderIcon {
background: color-mix(in srgb, var(--gl-color-text-secondary) 10%, #fff);
color: var(--gl-color-text-secondary);
}
.skeleton { .skeleton {
border-radius: var(--gl-radius-sm); border-radius: var(--gl-radius-sm);
background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
......
...@@ -14,10 +14,12 @@ import { ...@@ -14,10 +14,12 @@ import {
Modal, Modal,
Popconfirm, Popconfirm,
Progress, Progress,
StatePlaceholder,
Statistic, Statistic,
Tag, Tag,
Timeline, Timeline,
Tooltip, Tooltip,
Table,
} from '../index'; } from '../index';
import buttonStyles from './Button.module.css'; import buttonStyles from './Button.module.css';
import styles from './Shared.module.css'; import styles from './Shared.module.css';
...@@ -314,4 +316,60 @@ describe('feedback and display components', () => { ...@@ -314,4 +316,60 @@ describe('feedback and display components', () => {
expect(screen.queryByText('68%')).not.toBeInTheDocument(); expect(screen.queryByText('68%')).not.toBeInTheDocument();
}); });
it('renders StatePlaceholder failed requests without using empty-state copy', () => {
const onRetry = vi.fn();
render(
<StatePlaceholder
state="error"
title="加载失败"
description="数据请求失败,请稍后重试"
primaryAction={<button type="button" onClick={onRetry}>重试</button>}
/>,
);
expect(screen.getByRole('alert', { name: '加载失败' })).toHaveClass(styles.statePlaceholderError);
expect(screen.getByText('数据请求失败,请稍后重试')).toBeInTheDocument();
expect(screen.queryByText('暂无数据')).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '重试' }));
expect(onRetry).toHaveBeenCalledTimes(1);
});
it('renders the remaining StatePlaceholder semantic states with matching roles and defaults', () => {
render(
<>
<StatePlaceholder state="empty" />
<StatePlaceholder state="filtered-empty" />
<StatePlaceholder state="forbidden" />
<StatePlaceholder state="offline" />
</>,
);
expect(screen.getByRole('status', { name: '暂无数据' })).toBeInTheDocument();
expect(screen.getByRole('status', { name: '未找到匹配结果' })).toBeInTheDocument();
expect(screen.getByRole('alert', { name: '权限受限' })).toHaveClass(styles.statePlaceholderForbidden);
expect(screen.getByRole('alert', { name: '网络不可用' })).toHaveClass(styles.statePlaceholderOffline);
expect(screen.getByText('当前内容为空')).toBeInTheDocument();
expect(screen.getByText('请调整搜索或筛选条件')).toBeInTheDocument();
expect(screen.getByText('当前账号暂无访问权限')).toBeInTheDocument();
expect(screen.getByText('请检查网络连接后重试')).toBeInTheDocument();
});
it('allows Table content areas to render a recoverable failed request placeholder', () => {
render(
<Table
rowKey="id"
columns={[{ title: '名称', dataIndex: 'name' }]}
dataSource={[]}
empty={<StatePlaceholder state="error" title="列表加载失败" description="当前列表数据未知" primaryAction={<button type="button">重新加载</button>} />}
/>,
);
expect(screen.getByRole('alert', { name: '列表加载失败' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '重新加载' })).toBeInTheDocument();
expect(screen.queryByText('暂无数据')).not.toBeInTheDocument();
});
}); });
import { fireEvent, render, screen } from '@testing-library/react'; import { fireEvent, render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest'; import { describe, expect, it, vi } from 'vitest';
import styles from './Shared.module.css';
import { import {
Collapse, Collapse,
ColorInput, ColorInput,
ColorPicker, ColorPicker,
Empty, Empty,
Navigation,
Skeleton, Skeleton,
SkeletonAvatar, SkeletonAvatar,
SkeletonButton, SkeletonButton,
...@@ -84,6 +86,36 @@ describe('navigation, placeholder and color components', () => { ...@@ -84,6 +86,36 @@ describe('navigation, placeholder and color components', () => {
expect(onChange).toHaveBeenCalledWith(['one', 'two']); expect(onChange).toHaveBeenCalledWith(['one', 'two']);
}); });
it('renders hierarchical navigation with active child and parent states', () => {
const onChange = vi.fn();
render(
<Navigation
activeKey="agent-list"
onChange={onChange}
items={[
{
key: 'agent-management',
label: 'Agent管理',
children: [{ key: 'agent-list', label: 'Agent列表' }],
},
]}
/>,
);
const parentItem = screen.getByRole('button', { name: 'Agent管理' });
const childItem = screen.getByRole('button', { name: 'Agent列表' });
expect(parentItem).toHaveAttribute('data-active-parent', 'true');
expect(parentItem).not.toHaveClass('navigationItemParentActive');
expect(childItem).toHaveAttribute('aria-current', 'page');
expect(childItem).toHaveClass(styles.navigationItemActive, styles.navigationChild);
fireEvent.click(childItem);
expect(onChange).toHaveBeenCalledWith('agent-list');
});
it('selects preset colors and edits color input values', () => { it('selects preset colors and edits color input values', () => {
const onPickerChange = vi.fn(); const onPickerChange = vi.fn();
const onInputChange = vi.fn(); const onInputChange = vi.fn();
......
import { fireEvent, render, screen, within } from '@testing-library/react'; import { fireEvent, render, screen, within } from '@testing-library/react';
import { useState } from 'react';
import { describe, expect, it, vi } from 'vitest'; import { describe, expect, it, vi } from 'vitest';
import sharedStyles from './Shared.module.css'; import sharedStyles from './Shared.module.css';
...@@ -46,6 +47,13 @@ describe('selection, date, table and pagination components', () => { ...@@ -46,6 +47,13 @@ describe('selection, date, table and pagination components', () => {
expect(onChange).toHaveBeenCalledTimes(2); expect(onChange).toHaveBeenCalledTimes(2);
}); });
it('keeps the clear affordance hidden when allowClear is disabled', () => {
render(<Select aria-label="负责人" value="zhang" options={[{ label: '张三', value: 'zhang' }]} />);
expect(screen.getByRole('combobox', { name: '负责人' })).toHaveTextContent('张三');
expect(screen.queryByRole('button', { name: '清空负责人' })).not.toBeInTheDocument();
});
it('renders select trigger arrows with the softer helper icon color', () => { it('renders select trigger arrows with the softer helper icon color', () => {
render( render(
<> <>
...@@ -140,6 +148,52 @@ describe('selection, date, table and pagination components', () => { ...@@ -140,6 +148,52 @@ describe('selection, date, table and pagination components', () => {
expect(screen.getByRole('combobox', { name: '组织' })).toHaveTextContent('财务部'); expect(screen.getByRole('combobox', { name: '组织' })).toHaveTextContent('财务部');
}); });
it('closes the select popup immediately after choosing an option', () => {
render(<Select aria-label="所属岗位" options={[{ label: '全部', value: 'all' }, { label: '客服岗', value: 'customer-service' }]} />);
fireEvent.click(screen.getByRole('combobox', { name: '所属岗位' }));
expect(screen.getByRole('listbox')).toBeInTheDocument();
fireEvent.click(screen.getByRole('option', { name: '客服岗' }));
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
expect(screen.getByRole('combobox', { name: '所属岗位' })).toHaveTextContent('客服岗');
});
it('resets to the placeholder when a controlled select clears its value', () => {
function ControlledSelect() {
const [value, setValue] = useState<string | undefined>();
return (
<>
<Select
aria-label="所属岗位"
options={[{ label: '全部', value: 'all' }, { label: '客服岗', value: 'customer-service' }]}
placeholder="全部"
value={value}
onChange={(nextValue) => {
setValue(nextValue === 'all' ? undefined : nextValue);
}}
/>
<button type="button" onClick={() => setValue(undefined)}>
重置
</button>
</>
);
}
render(<ControlledSelect />);
fireEvent.click(screen.getByRole('combobox', { name: '所属岗位' }));
fireEvent.click(screen.getByRole('option', { name: '客服岗' }));
expect(screen.getByRole('combobox', { name: '所属岗位' })).toHaveTextContent('客服岗');
fireEvent.click(screen.getByRole('button', { name: '重置' }));
expect(screen.getByRole('combobox', { name: '所属岗位' })).toHaveTextContent('全部');
});
it('collapses an expanded TreeSelect parent when clicking it again', () => { it('collapses an expanded TreeSelect parent when clicking it again', () => {
render( render(
<TreeSelect <TreeSelect
...@@ -399,14 +453,20 @@ describe('selection, date, table and pagination components', () => { ...@@ -399,14 +453,20 @@ describe('selection, date, table and pagination components', () => {
render(<Pagination current={2} pageSize={10} total={95} onChange={onChange} />); render(<Pagination current={2} pageSize={10} total={95} onChange={onChange} />);
expect(screen.getByRole('button', { name: '第 2 页' })).toHaveAttribute('aria-current', 'page');
expect(screen.getByRole('button', { name: '第 2 页' })).toHaveClass(sharedStyles.paginationCurrent);
fireEvent.click(screen.getByRole('button', { name: '第 3 页' })); fireEvent.click(screen.getByRole('button', { name: '第 3 页' }));
fireEvent.change(screen.getByLabelText('每页条数'), { target: { value: '20' } }); fireEvent.change(screen.getByLabelText('每页条数'), { target: { value: '20' } });
fireEvent.change(screen.getByLabelText('跳至页码'), { target: { value: '5' } }); fireEvent.change(screen.getByLabelText('跳至页码'), { target: { value: '5' } });
fireEvent.click(screen.getByRole('button', { name: '跳转' })); fireEvent.click(screen.getByRole('button', { name: '跳转' }));
fireEvent.change(screen.getByLabelText('跳至页码'), { target: { value: '6' } });
fireEvent.keyDown(screen.getByLabelText('跳至页码'), { key: 'Enter' });
expect(screen.getByText('共 95 条')).toBeInTheDocument(); expect(screen.getByText('共 95 条')).toBeInTheDocument();
expect(onChange).toHaveBeenNthCalledWith(1, 3, 10); expect(onChange).toHaveBeenNthCalledWith(1, 3, 10);
expect(onChange).toHaveBeenNthCalledWith(2, 1, 20); expect(onChange).toHaveBeenNthCalledWith(2, 1, 20);
expect(onChange).toHaveBeenNthCalledWith(3, 5, 10); expect(onChange).toHaveBeenNthCalledWith(3, 5, 10);
expect(onChange).toHaveBeenNthCalledWith(4, 6, 10);
}); });
}); });
...@@ -16,8 +16,8 @@ export type { InputProps, SearchInputProps } from './components/Input'; ...@@ -16,8 +16,8 @@ export type { InputProps, SearchInputProps } from './components/Input';
export { Input, SearchInput } from './components/Input'; export { Input, SearchInput } from './components/Input';
export type { TextareaProps } from './components/Textarea'; export type { TextareaProps } from './components/Textarea';
export { Textarea } from './components/Textarea'; export { Textarea } from './components/Textarea';
export type { CollapseItem, CollapseProps, EmptyProps, StepsProps, TabsItem, TabsProps } from './components/Navigation'; export type { CollapseItem, CollapseProps, EmptyProps, NavigationItem, NavigationProps, StatePlaceholderProps, StepsProps, TabsItem, TabsProps } from './components/Navigation';
export { Collapse, Empty, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonInput, SkeletonParagraph, Steps, Tabs } from './components/Navigation'; export { Collapse, Empty, Navigation, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonInput, SkeletonParagraph, StatePlaceholder, Steps, Tabs } from './components/Navigation';
export type { PaginationProps } from './components/Pagination'; export type { PaginationProps } from './components/Pagination';
export { Pagination } from './components/Pagination'; export { Pagination } from './components/Pagination';
export type { RadioProps } from './components/Radio'; export type { RadioProps } from './components/Radio';
......
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
import { render, screen } from '@testing-library/react'; import { fireEvent, render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom'; import { MemoryRouter } from 'react-router-dom';
import { describe, expect, it } from 'vitest'; import { beforeEach, describe, expect, it } from 'vitest';
import { App } from './App'; import { App } from './App';
const loginStorageKey = 'agent-admin-local-login';
function renderApp(path: string) {
return render(
<MemoryRouter initialEntries={[path]}>
<App />
</MemoryRouter>,
);
}
describe('App foundation', () => { describe('App foundation', () => {
beforeEach(() => {
window.localStorage.clear();
});
it('renders the root layout for the React application', () => { it('renders the root layout for the React application', () => {
render( renderApp('/components');
<MemoryRouter initialEntries={['/']}>
<App />
</MemoryRouter>,
);
expect(screen.getByRole('main')).toBeInTheDocument(); expect(screen.getByRole('main')).toBeInTheDocument();
expect(screen.getByText('Agent Admin Web')).toBeInTheDocument(); expect(screen.getByText('Agent Admin Web')).toBeInTheDocument();
}); });
it('renders the independent component demo route', () => { it('renders the independent component demo route', () => {
render( renderApp('/components');
<MemoryRouter initialEntries={['/components']}>
<App />
</MemoryRouter>,
);
expect(screen.getByRole('heading', { name: '组件库 Demo' })).toBeInTheDocument(); expect(screen.getByRole('heading', { name: '组件库 Demo' })).toBeInTheDocument();
expect(screen.getByText('全局 UI 组件库展示入口')).toBeInTheDocument(); expect(screen.getByText('全局 UI 组件库展示入口')).toBeInTheDocument();
expect(screen.queryByRole('heading', { name: 'Agent管理' })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: '退出登录' })).not.toBeInTheDocument();
});
});
describe('Admin login and protected routes', () => {
beforeEach(() => {
window.localStorage.clear();
});
it('redirects anonymous users to login and returns to the requested protected route after login', () => {
renderApp('/agents?scenario=error');
expect(screen.getByRole('heading', { name: '岗位Agent管理后台' })).toBeInTheDocument();
expect(screen.getByLabelText('账号')).toBeInTheDocument();
expect(screen.getByLabelText('密码')).toBeInTheDocument();
fireEvent.change(screen.getByLabelText('账号'), { target: { value: 'admin' } });
fireEvent.change(screen.getByLabelText('密码'), { target: { value: '123456' } });
fireEvent.click(screen.getByRole('button', { name: '登录' }));
expect(window.localStorage.getItem(loginStorageKey)).toBe('true');
expect(screen.getByRole('heading', { name: 'Agent管理' })).toBeInTheDocument();
expect(screen.getByRole('alert', { name: '加载失败' })).toBeInTheDocument();
expect(screen.getByText('岗位Agent管理后台')).toBeInTheDocument();
expect(screen.getByLabelText('管理员')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '退出登录' })).toBeInTheDocument();
});
it('shows validation and credential errors without marking the user as logged in', () => {
renderApp('/login');
fireEvent.click(screen.getByRole('button', { name: '登录' }));
expect(screen.getByText('请输入账号')).toBeInTheDocument();
expect(screen.getByText('请输入密码')).toBeInTheDocument();
expect(window.localStorage.getItem(loginStorageKey)).toBeNull();
fireEvent.change(screen.getByLabelText('账号'), { target: { value: 'admin' } });
fireEvent.change(screen.getByLabelText('密码'), { target: { value: 'wrong' } });
fireEvent.click(screen.getByRole('button', { name: '登录' }));
expect(screen.getByText('账号或密码错误')).toBeInTheDocument();
expect(window.localStorage.getItem(loginStorageKey)).toBeNull();
});
it('keeps logged-in users on refresh and clears local state on logout', () => {
window.localStorage.setItem(loginStorageKey, 'true');
renderApp('/agents');
expect(screen.getByRole('heading', { name: 'Agent管理' })).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '退出登录' }));
expect(screen.getByRole('dialog', { name: '确认退出登录?' })).toBeInTheDocument();
expect(window.localStorage.getItem(loginStorageKey)).toBe('true');
fireEvent.click(screen.getByRole('button', { name: '取消' }));
expect(screen.queryByRole('dialog', { name: '确认退出登录?' })).not.toBeInTheDocument();
expect(window.localStorage.getItem(loginStorageKey)).toBe('true');
fireEvent.click(screen.getByRole('button', { name: '退出登录' }));
fireEvent.click(screen.getByRole('button', { name: '确定' }));
expect(window.localStorage.getItem(loginStorageKey)).toBeNull();
expect(screen.getByRole('heading', { name: '岗位Agent管理后台' })).toBeInTheDocument();
});
it('renders hierarchical admin navigation with the child route selected', () => {
window.localStorage.setItem(loginStorageKey, 'true');
renderApp('/agents');
expect(screen.getByRole('button', { name: 'Agent管理' })).toHaveAttribute('data-active-parent', 'true');
expect(screen.getByRole('button', { name: 'Agent列表' })).toHaveAttribute('aria-current', 'page');
}); });
}); });
import { Navigate, Route, Routes } from 'react-router-dom'; import { Navigate, Route, Routes } from 'react-router-dom';
import { AdminShell } from './layouts/AdminShell';
import { RootLayout } from './layouts/RootLayout'; import { RootLayout } from './layouts/RootLayout';
import { AgentListPage } from './routes/agents/AgentListPage';
import { ComponentsDemoPage } from './routes/components/ComponentsDemoPage'; import { ComponentsDemoPage } from './routes/components/ComponentsDemoPage';
import { LoginPage } from './routes/login/LoginPage';
import { ProtectedRoute } from './routes/ProtectedRoute';
export function App() { export function App() {
return ( return (
<Routes> <Routes>
<Route path="login" element={<LoginPage />} />
<Route element={<ProtectedRoute />}>
<Route element={<AdminShell />}>
<Route index element={<Navigate to="/agents" replace />} />
<Route path="agents" element={<AgentListPage />} />
</Route>
</Route>
<Route element={<RootLayout />}> <Route element={<RootLayout />}>
<Route index element={<Navigate to="/components" replace />} />
<Route path="components" element={<ComponentsDemoPage />} /> <Route path="components" element={<ComponentsDemoPage />} />
</Route> </Route>
<Route path="*" element={<Navigate to="/agents" replace />} />
</Routes> </Routes>
); );
} }
export const localLoginStorageKey = 'agent-admin-local-login';
export const adminCredentials = {
username: 'admin',
password: '123456',
} as const;
export function isLoggedIn() {
return window.localStorage.getItem(localLoginStorageKey) === 'true';
}
export function login(username: string, password: string) {
const ok = username === adminCredentials.username && password === adminCredentials.password;
if (ok) {
window.localStorage.setItem(localLoginStorageKey, 'true');
}
return ok;
}
export function logout() {
window.localStorage.removeItem(localLoginStorageKey);
}
import { useState } from 'react';
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
import { Avatar, Button, Modal, Navigation } from '../../packages/ui/src';
import { logout } from '../auth/localAuth';
export function AdminShell() {
const location = useLocation();
const navigate = useNavigate();
const [logoutConfirmOpen, setLogoutConfirmOpen] = useState(false);
const activeNavigationKey = location.pathname.startsWith('/agents') ? 'agent-list' : undefined;
const navigationItems = [
{
key: 'agent-management',
label: 'Agent管理',
children: [{ key: 'agent-list', label: 'Agent列表' }],
},
];
return (
<div className="grid min-h-screen grid-cols-[180px_1fr] bg-[var(--gl-color-bg-page)] text-[var(--gl-color-text-primary)] max-[760px]:grid-cols-1">
<aside className="flex flex-col gap-4 border-r border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-4">
<div className="grid gap-1">
<p className="m-0 text-xs leading-[var(--gl-line-height-sm)] text-[var(--gl-color-text-secondary)]">Admin Console</p>
<h1 className="m-0 whitespace-nowrap text-base font-semibold leading-[var(--gl-line-height-lg)]">岗位Agent管理后台</h1>
</div>
<Navigation
activeKey={activeNavigationKey}
ariaLabel="管理后台导航"
items={navigationItems}
onChange={(key) => {
if (key === 'agent-list') navigate('/agents');
}}
/>
</aside>
<div className="grid min-w-0 grid-rows-[auto_1fr]">
<header className="flex min-h-14 items-center justify-between border-b border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 text-sm text-[var(--gl-color-text-secondary)] max-[760px]:px-4">
<span>Agent管理 / Agent列表</span>
<div className="flex items-center gap-3">
<Avatar name="管理员" />
<Button
variant="outline"
onClick={() => setLogoutConfirmOpen(true)}
>
退出登录
</Button>
</div>
</header>
<main className="p-8 max-[760px]:p-4">
<Outlet />
</main>
</div>
<Modal
open={logoutConfirmOpen}
title="确认退出登录?"
onCancel={() => setLogoutConfirmOpen(false)}
onOk={() => {
setLogoutConfirmOpen(false);
logout();
navigate('/login', { replace: true, state: { from: location } });
}}
>
<p className="m-0 text-sm leading-[var(--gl-line-height-md)] text-[var(--gl-color-text-secondary)]">
退出后将返回登录页,当前后台操作上下文不会保留。
</p>
</Modal>
</div>
);
}
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { isLoggedIn } from '../auth/localAuth';
export function ProtectedRoute() {
const location = useLocation();
if (!isLoggedIn()) {
return <Navigate to="/login" replace state={{ from: location }} />;
}
return <Outlet />;
}
import { fireEvent, render, screen, within } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { beforeEach, describe, expect, it } from 'vitest';
import { App } from '../../App';
function renderAgents(path = '/agents') {
window.localStorage.setItem('agent-admin-local-login', 'true');
return render(
<MemoryRouter initialEntries={[path]}>
<App />
</MemoryRouter>,
);
}
describe('AgentListPage', () => {
beforeEach(() => {
window.localStorage.clear();
});
it('renders the list structure, manager row rules, status tags and pagination', () => {
renderAgents();
expect(screen.getByRole('heading', { name: 'Agent管理' })).toBeInTheDocument();
expect(screen.getByText('Agent名称:')).toBeInTheDocument();
expect(screen.getByText('所属岗位:')).toBeInTheDocument();
expect(screen.getByText('状态:')).toBeInTheDocument();
expect(screen.getByLabelText('搜索Agent名称')).toBeInTheDocument();
expect(screen.getByRole('combobox', { name: '岗位筛选' })).toBeInTheDocument();
expect(screen.getByRole('combobox', { name: '状态筛选' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '搜索' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '重置' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '新建Agent' })).toBeInTheDocument();
const rows = screen.getAllByRole('row');
expect(within(rows[1]).getByText('管家Agent')).toBeInTheDocument();
expect(within(rows[1]).getByText('系统调度')).toBeInTheDocument();
expect(within(rows[1]).getByText('-')).toBeInTheDocument();
expect(within(rows[2]).getByText('复盘Agent')).toBeInTheDocument();
expect(screen.getAllByText('已上架').length).toBeGreaterThan(0);
expect(screen.getByText('共 6 条')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '第 1 页' })).toHaveAttribute('aria-current', 'page');
expect(screen.queryByRole('button', { name: '第 2 页' })).not.toBeInTheDocument();
});
it('keeps search controls at a consistent 200px width', () => {
renderAgents();
expect(screen.getByTestId('agent-keyword-control')).toHaveClass('w-[200px]');
expect(screen.getByTestId('agent-position-control')).toHaveClass('w-[200px]');
expect(screen.getByTestId('agent-status-control')).toHaveClass('w-[200px]');
});
it('lays out search fields as label-control rows with actions on the right', () => {
renderAgents();
const toolbar = screen.getByTestId('agent-search-toolbar');
const keywordField = screen.getByTestId('agent-keyword-field');
const positionField = screen.getByTestId('agent-position-field');
const statusField = screen.getByTestId('agent-status-field');
const actionGroup = screen.getByTestId('agent-search-actions');
expect(toolbar).toHaveClass('justify-between');
expect(keywordField).toHaveClass('flex', 'items-center');
expect(positionField).toHaveClass('flex', 'items-center');
expect(statusField).toHaveClass('flex', 'items-center');
expect(positionField.tagName).toBe('DIV');
expect(statusField.tagName).toBe('DIV');
expect(within(keywordField).getByText('Agent名称:')).toHaveClass('shrink-0');
expect(actionGroup).toHaveClass('ml-auto', 'justify-end');
expect(within(actionGroup).getByRole('button', { name: '搜索' })).toBeInTheDocument();
expect(within(actionGroup).getByRole('button', { name: '重置' })).toBeInTheDocument();
});
it('filters only after search submission and resets to the first page', () => {
renderAgents();
fireEvent.change(screen.getByLabelText('搜索Agent名称'), { target: { value: '复盘' } });
fireEvent.click(screen.getByRole('combobox', { name: '岗位筛选' }));
fireEvent.click(screen.getByRole('option', { name: '客服岗' }));
expect(screen.getByText('复盘Agent')).toBeInTheDocument();
expect(screen.queryByRole('status', { name: '未找到匹配结果' })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('combobox', { name: '状态筛选' }));
fireEvent.click(screen.getByRole('option', { name: '已停用' }));
expect(screen.getByText('复盘Agent')).toBeInTheDocument();
expect(screen.queryByRole('status', { name: '未找到匹配结果' })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '搜索' }));
expect(screen.getByRole('button', { name: '第 1 页' })).toHaveAttribute('aria-current', 'page');
expect(screen.getByRole('status', { name: '未找到匹配结果' })).toBeInTheDocument();
expect(screen.getByRole('combobox', { name: '岗位筛选' })).toHaveTextContent('客服岗');
fireEvent.click(screen.getByRole('button', { name: '重置' }));
expect(screen.getByLabelText('搜索Agent名称')).toHaveValue('');
expect(screen.getByRole('combobox', { name: '岗位筛选' })).toHaveTextContent('全部');
expect(screen.getByText('复盘Agent')).toBeInTheDocument();
expect(screen.getByText('质检Agent')).toBeInTheDocument();
});
it('keeps pagination in sync with the selected page size', () => {
renderAgents();
expect(screen.getByLabelText('每页条数')).toHaveValue('10');
fireEvent.change(screen.getByRole('combobox', { name: '每页条数' }), { target: { value: '20' } });
expect(screen.getByLabelText('每页条数')).toHaveValue('20');
expect(screen.getByRole('button', { name: '第 1 页' })).toHaveAttribute('aria-current', 'page');
});
it('uses the 全部 position option as the reset entry and hides the extra clear button', () => {
renderAgents();
fireEvent.click(screen.getByRole('combobox', { name: '岗位筛选' }));
expect(screen.getByRole('option', { name: '全部' })).toBeInTheDocument();
fireEvent.click(screen.getByRole('option', { name: '客服岗' }));
fireEvent.click(screen.getByRole('button', { name: '搜索' }));
expect(screen.queryByRole('button', { name: '清空岗位筛选' })).not.toBeInTheDocument();
expect(screen.queryByText('清空')).not.toBeInTheDocument();
expect(screen.getByText('质检Agent')).toBeInTheDocument();
expect(screen.queryByText('复盘Agent')).not.toBeInTheDocument();
});
it('shows operation availability and deletion confirmation copy', () => {
renderAgents();
const managerRow = screen.getByRole('row', { name: /管家Agent/ });
expect(within(managerRow).getByRole('button', { name: '编辑管家Agent' })).toBeEnabled();
expect(within(managerRow).queryByRole('button', { name: '停用管家Agent' })).not.toBeInTheDocument();
expect(within(managerRow).queryByRole('button', { name: '删除管家Agent' })).not.toBeInTheDocument();
const reviewRow = screen.getByRole('row', { name: /复盘Agent/ });
fireEvent.click(within(reviewRow).getByRole('button', { name: '删除复盘Agent' }));
expect(screen.getByRole('dialog', { name: '确认删除 Agent "复盘Agent"?' })).toBeInTheDocument();
expect(screen.getByText(/企微员工会从所有已关联群中退出/)).toBeInTheDocument();
expect(screen.getByText(/关联的岗位标签不受影响/)).toBeInTheDocument();
});
it('shows a recoverable failure state without the empty-data headline', () => {
renderAgents('/agents?scenario=error');
expect(screen.getByRole('alert', { name: '加载失败' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '重试' })).toBeInTheDocument();
expect(screen.queryByText('暂无数据')).not.toBeInTheDocument();
expect(screen.getByRole('button', { name: '退出登录' })).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '重试' }));
expect(screen.getByText('复盘Agent')).toBeInTheDocument();
});
});
import { useMemo, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import { Button, Input, Modal, Pagination, Select, StatePlaceholder, Table, Tag } from '../../../packages/ui/src';
import {
agentListMockFixtures,
agentPositionOptions,
getAgentListPage,
type AgentListMockItem,
type AgentListMockFixture,
type AgentStatus,
} from '../../../packages/contracts/agent-list-mock';
const defaultPageSize = 10;
function getFixtureByScenario(scenario: string): AgentListMockFixture {
switch (scenario) {
case 'error':
return agentListMockFixtures.error;
case 'loading':
return agentListMockFixtures.loading;
case 'empty':
return agentListMockFixtures.empty;
case 'filteredEmpty':
return agentListMockFixtures.filteredEmpty;
case 'managerOnly':
return agentListMockFixtures.managerOnly;
case 'longText':
return agentListMockFixtures.longText;
case 'disabledActions':
return agentListMockFixtures.disabledActions;
case 'paginationBoundary':
return agentListMockFixtures.paginationBoundary;
default:
return agentListMockFixtures.normal;
}
}
function statusText(status: AgentStatus) {
return status === 'enable' ? '已上架' : '已停用';
}
function statusTag(status: AgentStatus) {
return status === 'enable' ? 'success' : 'warning';
}
function AgentActions({ agent }: { agent: AgentListMockItem }) {
const [deleteOpen, setDeleteOpen] = useState(false);
return (
<span className="flex flex-wrap gap-1">
<Button aria-label={`编辑${agent.name}`} size="small" variant="text">编辑</Button>
{agent.available_actions.includes('disable') ? <Button aria-label={`停用${agent.name}`} size="small" variant="text">停用</Button> : null}
{agent.available_actions.includes('enable') ? <Button aria-label={`上架${agent.name}`} size="small" variant="text">上架</Button> : null}
{agent.available_actions.includes('delete') ? (
<>
<Button aria-label={`删除${agent.name}`} size="small" variant="danger" onClick={() => setDeleteOpen(true)}>删除</Button>
<Modal open={deleteOpen} title={`确认删除 Agent "${agent.name}"?`} onCancel={() => setDeleteOpen(false)} onOk={() => setDeleteOpen(false)}>
<p className="m-0 max-w-[360px] leading-[var(--gl-line-height-md)] text-[var(--gl-color-text-secondary)]">
该 Agent 的企微员工会从所有已关联群中退出、官网展示配置会被清理、渠道活码 Agent 列表中不再出现该 Agent、关联的岗位标签不受影响
</p>
</Modal>
</>
) : null}
</span>
);
}
export function AgentListPage() {
const [searchParams] = useSearchParams();
const [scenario, setScenario] = useState(searchParams.get('scenario') ?? 'normal');
const [keyword, setKeyword] = useState('');
const [submittedKeyword, setSubmittedKeyword] = useState('');
const [positionId, setPositionId] = useState<string | undefined>();
const [submittedPositionId, setSubmittedPositionId] = useState<string | undefined>();
const [status, setStatus] = useState<AgentStatus | 'all'>('all');
const [submittedStatus, setSubmittedStatus] = useState<AgentStatus | 'all'>('all');
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(defaultPageSize);
const fixture = getFixtureByScenario(scenario);
const result = useMemo(
() => getAgentListPage({ keyword: submittedKeyword, page, pageSize, positionId: submittedPositionId, status: submittedStatus, source: fixture.items }),
[fixture.items, page, pageSize, submittedKeyword, submittedPositionId, submittedStatus],
);
const hasFilter = Boolean(submittedKeyword || submittedPositionId || submittedStatus !== 'all');
const resetToFirstPage = () => setPage(1);
const submitFilters = () => {
setSubmittedKeyword(keyword);
setSubmittedPositionId(positionId);
setSubmittedStatus(status);
resetToFirstPage();
};
const resetFilters = () => {
setKeyword('');
setSubmittedKeyword('');
setPositionId(undefined);
setSubmittedPositionId(undefined);
setStatus('all');
setSubmittedStatus('all');
resetToFirstPage();
};
const columns = [
{
title: 'Agent名称',
key: 'name',
render: (_: unknown, agent: AgentListMockItem) => (
<span className="grid gap-0.5">
<strong>{agent.name}</strong>
<span className="text-xs text-[var(--gl-color-text-secondary)]">ID: {agent.agent_id}</span>
</span>
),
},
{
title: '所属岗位',
key: 'positions',
render: (_: unknown, agent: AgentListMockItem) => (
<span className="flex flex-wrap gap-1">
{agent.is_manager ? <Tag status="info">系统调度</Tag> : agent.positions.map((position) => <Tag key={position.id}>{position.name}</Tag>)}
</span>
),
},
{ title: '状态', dataIndex: 'status', render: (value: unknown) => <Tag status={statusTag(value as AgentStatus)}>{statusText(value as AgentStatus)}</Tag> },
{ title: '绑定群数', dataIndex: 'bound_group_count' },
{ title: '绑定Skill数', key: 'skill', render: (_: unknown, agent: AgentListMockItem) => (agent.is_manager ? '-' : agent.bound_skill_count) },
{ title: '更新时间', dataIndex: 'updated_at' },
{
title: '操作',
key: 'actions',
render: (_: unknown, agent: AgentListMockItem) => <AgentActions agent={agent} />,
},
];
return (
<section className="grid gap-6">
<header className="flex items-center justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6">
<div>
<h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">Agent管理</h2>
<p className="m-0 mt-1 text-sm text-[var(--gl-color-text-secondary)]">管理岗位 Agent、管家 Agent 与列表 mock 数据状态</p>
</div>
<Button variant="primary">新建Agent</Button>
</header>
<div className="flex flex-wrap items-center justify-between gap-4 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-6" data-testid="agent-search-toolbar">
<div className="flex flex-wrap items-center gap-x-6 gap-y-4">
<div className="flex items-center gap-2 text-sm" data-testid="agent-keyword-field">
<span className="shrink-0">Agent名称:</span>
<span className="w-[200px]" data-testid="agent-keyword-control">
<Input
aria-label="搜索Agent名称"
className="w-full"
placeholder="搜索 Agent 名称"
value={keyword}
allowClear
onChange={setKeyword}
onKeyDown={(event) => {
if (event.key === 'Enter') submitFilters();
}}
/>
</span>
</div>
<div className="flex items-center gap-2 text-sm" data-testid="agent-position-field">
<span className="shrink-0">所属岗位:</span>
<span className="w-[200px]" data-testid="agent-position-control">
<Select
aria-label="岗位筛选"
options={[{ label: '全部', value: 'all' }, ...agentPositionOptions.map((option) => ({ label: option.name, value: option.id }))]}
placeholder="全部"
value={positionId}
onChange={(value) => {
setPositionId(value === 'all' ? undefined : value);
}}
/>
</span>
</div>
<div className="flex items-center gap-2 text-sm" data-testid="agent-status-field">
<span className="shrink-0">状态:</span>
<span className="w-[200px]" data-testid="agent-status-control">
<Select
aria-label="状态筛选"
options={[
{ label: '全部', value: 'all' },
{ label: '已上架', value: 'enable' },
{ label: '已停用', value: 'disable' },
]}
value={status}
onChange={(value) => {
setStatus((value as AgentStatus | 'all') ?? 'all');
}}
/>
</span>
</div>
</div>
<div className="ml-auto flex items-center justify-end gap-3" data-testid="agent-search-actions">
<Button variant="primary" onClick={submitFilters}>搜索</Button>
<Button variant="outline" onClick={resetFilters}>重置</Button>
</div>
</div>
<div className="grid gap-6 overflow-x-auto rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-6">
{fixture.error ? (
<StatePlaceholder
state="error"
title="加载失败"
description="Agent 列表请求失败,当前数据状态未知"
primaryAction={<Button size="small" onClick={() => setScenario('normal')}>重试</Button>}
/>
) : (
<>
<Table
rowKey="agent_id"
columns={columns}
dataSource={result.items}
loading={fixture.loading}
empty={{
description: hasFilter ? '未找到匹配结果' : '当前还没有 Agent',
action: hasFilter ? <Button size="small" onClick={resetFilters}>清空筛选</Button> : undefined,
}}
/>
{result.items.length === 0 && hasFilter ? <StatePlaceholder state="filtered-empty" /> : null}
<Pagination
current={page}
pageSize={pageSize}
total={result.total}
onChange={(nextPage, nextPageSize) => {
setPage(nextPage);
setPageSize(nextPageSize);
}}
/>
</>
)}
</div>
</section>
);
}
...@@ -72,3 +72,9 @@ ...@@ -72,3 +72,9 @@
gap: var(--gl-spacing-xl); gap: var(--gl-spacing-xl);
align-items: start; align-items: start;
} }
.placeholderDemo {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: var(--gl-spacing-lg);
}
...@@ -19,6 +19,11 @@ describe('ComponentsDemoPage', () => { ...@@ -19,6 +19,11 @@ describe('ComponentsDemoPage', () => {
expect(screen.getByText('上传')).toBeInTheDocument(); expect(screen.getByText('上传')).toBeInTheDocument();
expect(screen.getByText('暂无审批记录')).toBeInTheDocument(); expect(screen.getByText('暂无审批记录')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '新建审批' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '新建审批' })).toBeInTheDocument();
expect(screen.getByRole('alert', { name: '加载失败' })).toBeInTheDocument();
expect(screen.getByRole('status', { name: '暂无数据' })).toBeInTheDocument();
expect(screen.getByRole('status', { name: '未找到匹配结果' })).toBeInTheDocument();
expect(screen.getByRole('alert', { name: '权限受限' })).toBeInTheDocument();
expect(screen.getByRole('alert', { name: '网络不可用' })).toBeInTheDocument();
expect(screen.getByText('点击或拖拽业务资料到此上传')).toBeInTheDocument(); expect(screen.getByText('点击或拖拽业务资料到此上传')).toBeInTheDocument();
expect(screen.getByText('图片/视频')).toBeInTheDocument(); expect(screen.getByText('图片/视频')).toBeInTheDocument();
expect(screen.getByText('4/20')).toBeInTheDocument(); expect(screen.getByText('4/20')).toBeInTheDocument();
...@@ -115,4 +120,11 @@ describe('ComponentsDemoPage', () => { ...@@ -115,4 +120,11 @@ describe('ComponentsDemoPage', () => {
expect(screen.getByLabelText('视频')).toBeInTheDocument(); expect(screen.getByLabelText('视频')).toBeInTheDocument();
expect(screen.getByText('支持 JPG、PNG、MP4、MOV,图片单张不超过 10MB,视频单个不超过 500MB')).toBeInTheDocument(); expect(screen.getByText('支持 JPG、PNG、MP4、MOV,图片单张不超过 10MB,视频单个不超过 500MB')).toBeInTheDocument();
}); });
it('keeps the component demo route isolated from the admin shell copy', () => {
render(<ComponentsDemoPage />);
expect(screen.queryByText('岗位Agent管理后台')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: '退出登录' })).not.toBeInTheDocument();
});
}); });
...@@ -21,6 +21,7 @@ import { ...@@ -21,6 +21,7 @@ import {
Message, Message,
MediaWall, MediaWall,
Modal, Modal,
Navigation,
Pagination, Pagination,
Popconfirm, Popconfirm,
Progress, Progress,
...@@ -28,6 +29,7 @@ import { ...@@ -28,6 +29,7 @@ import {
SearchInput, SearchInput,
Select, Select,
Skeleton, Skeleton,
StatePlaceholder,
Steps, Steps,
Switch, Switch,
Table, Table,
...@@ -54,6 +56,27 @@ export function ComponentsDemoPage() { ...@@ -54,6 +56,27 @@ export function ComponentsDemoPage() {
'data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2296%22 height=%2296%22 viewBox=%220 0 96 96%22%3E%3Crect width=%2296%22 height=%2296%22 fill=%22%23dbeafe%22/%3E%3Ccircle cx=%2232%22 cy=%2235%22 r=%2210%22 fill=%22%232468f2%22/%3E%3Cpath d=%22M12 78 39 52l14 13 12-17 19 30Z%22 fill=%22%231f5bd6%22/%3E%3C/svg%3E'; 'data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2296%22 height=%2296%22 viewBox=%220 0 96 96%22%3E%3Crect width=%2296%22 height=%2296%22 fill=%22%23dbeafe%22/%3E%3Ccircle cx=%2232%22 cy=%2235%22 r=%2210%22 fill=%22%232468f2%22/%3E%3Cpath d=%22M12 78 39 52l14 13 12-17 19 30Z%22 fill=%22%231f5bd6%22/%3E%3C/svg%3E';
const mediaVideo = const mediaVideo =
'data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2296%22 height=%2296%22 viewBox=%220 0 96 96%22%3E%3Crect width=%2296%22 height=%2296%22 fill=%22%231f2633%22/%3E%3Cpath d=%22M18 72 38 45l13 12 11-18 16 33Z%22 fill=%22%23667085%22/%3E%3Ccircle cx=%2270%22 cy=%2226%22 r=%2210%22 fill=%22%23f59e0b%22/%3E%3C/svg%3E'; 'data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2296%22 height=%2296%22 viewBox=%220 0 96 96%22%3E%3Crect width=%2296%22 height=%2296%22 fill=%22%231f2633%22/%3E%3Cpath d=%22M18 72 38 45l13 12 11-18 16 33Z%22 fill=%22%23667085%22/%3E%3Ccircle cx=%2270%22 cy=%2226%22 r=%2210%22 fill=%22%23f59e0b%22/%3E%3C/svg%3E';
const placeholderStates = [
{ state: 'empty' as const, title: '暂无数据', description: '请先创建项目' },
{
state: 'filtered-empty' as const,
title: '未找到匹配结果',
description: '请调整搜索或筛选条件',
secondaryAction: <Button size="small">清空筛选</Button>,
},
{
state: 'forbidden' as const,
title: '权限受限',
description: '当前账号暂无访问权限',
primaryAction: <Button size="small">申请权限</Button>,
},
{
state: 'offline' as const,
title: '网络不可用',
description: '请检查网络连接后重试',
primaryAction: <Button size="small">重新连接</Button>,
},
];
return ( return (
<section className={styles.page}> <section className={styles.page}>
...@@ -169,9 +192,33 @@ export function ComponentsDemoPage() { ...@@ -169,9 +192,33 @@ export function ComponentsDemoPage() {
<section className={styles.group}> <section className={styles.group}>
<h3>导航与占位</h3> <h3>导航与占位</h3>
<div className={styles.grid}> <div className={styles.grid}>
<Navigation
activeKey="agent-list"
items={[
{ key: 'agent-management', label: 'Agent管理', children: [{ key: 'agent-list', label: 'Agent列表' }] },
]}
/>
<Tabs activeKey="base" items={[{ key: 'base', label: '基础信息', children: '基础内容' }, { key: 'advanced', label: '高级配置', children: '高级内容' }]} /> <Tabs activeKey="base" items={[{ key: 'base', label: '基础信息', children: '基础内容' }, { key: 'advanced', label: '高级配置', children: '高级内容' }]} />
<Steps current={1} items={[{ title: '提交' }, { title: '审批' }, { title: '完成' }]} /> <Steps current={1} items={[{ title: '提交' }, { title: '审批' }, { title: '完成' }]} />
<Empty description="暂无项目" action={<Button>新建项目</Button>} /> <Empty description="暂无项目" action={<Button>新建项目</Button>} />
<StatePlaceholder
state="error"
title="加载失败"
description="列表请求失败,当前数据状态未知"
primaryAction={<Button size="small">重试</Button>}
/>
<div className={styles.placeholderDemo}>
{placeholderStates.map((item) => (
<StatePlaceholder
key={item.state}
state={item.state}
title={item.title}
description={item.description}
primaryAction={item.primaryAction}
secondaryAction={item.secondaryAction}
/>
))}
</div>
<Skeleton active /> <Skeleton active />
<Collapse activeKeys={['one']} items={[{ key: 'one', title: '基础设置', children: '设置内容' }]} /> <Collapse activeKeys={['one']} items={[{ key: 'one', title: '基础设置', children: '设置内容' }]} />
</div> </div>
......
import { type FormEvent, useState } from 'react';
import { Navigate, useLocation, useNavigate } from 'react-router-dom';
import { Button, Input } from '../../../packages/ui/src';
import { isLoggedIn, login } from '../../auth/localAuth';
interface LocationState {
from?: {
pathname?: string;
search?: string;
};
}
export function LoginPage() {
const location = useLocation();
const navigate = useNavigate();
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [errors, setErrors] = useState<{ username?: string; password?: string; form?: string }>({});
if (isLoggedIn()) {
return <Navigate to="/agents" replace />;
}
const state = location.state as LocationState | null;
const target = `${state?.from?.pathname ?? '/agents'}${state?.from?.search ?? ''}`;
const submit = (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
const nextErrors = {
username: username.trim() ? undefined : '请输入账号',
password: password ? undefined : '请输入密码',
};
if (nextErrors.username || nextErrors.password) {
setErrors(nextErrors);
return;
}
if (!login(username.trim(), password)) {
setErrors({ form: '账号或密码错误' });
return;
}
navigate(target, { replace: true });
};
return (
<main className="grid min-h-screen place-items-center bg-[var(--gl-color-bg-page)] p-8">
<section className="grid w-full max-w-[420px] gap-6 rounded-[14px] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-8 shadow-[0_24px_60px_rgb(16_24_40_/_12%)]">
<div className="grid gap-1">
<h1 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">岗位Agent管理后台</h1>
<p className="m-0 text-sm text-[var(--gl-color-text-secondary)]">使用一期固定管理员账号进入本地管理后台</p>
</div>
<form className="grid gap-4" onSubmit={submit}>
<label className="grid gap-1 text-sm">
账号
<Input aria-label="账号" status={errors.username ? 'error' : 'default'} value={username} onChange={setUsername} />
{errors.username ? <span className="m-0 text-xs text-[#d92d20]">{errors.username}</span> : null}
</label>
<label className="grid gap-1 text-sm">
密码
<Input aria-label="密码" status={errors.password ? 'error' : 'default'} type="password" value={password} onChange={setPassword} />
{errors.password ? <span className="m-0 text-xs text-[#d92d20]">{errors.password}</span> : null}
</label>
{errors.form ? <p className="m-0 text-xs text-[#d92d20]">{errors.form}</p> : null}
<Button type="submit" variant="primary">登录</Button>
</form>
</section>
</main>
);
}
@import './tokens.css'; @import './tokens.css';
@import './reset.css'; @import './reset.css';
@tailwind utilities;
import type { Config } from 'tailwindcss';
export default {
content: ['./index.html', './src/**/*.{ts,tsx}', './packages/**/*.{ts,tsx}'],
theme: {
extend: {},
},
plugins: [],
} satisfies Config;
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
"jsx": "react-jsx", "jsx": "react-jsx",
"types": ["vitest/globals", "@testing-library/jest-dom"] "types": ["vitest/globals", "@testing-library/jest-dom"]
}, },
"include": ["src", "packages/ui/src"] "include": ["src", "packages/ui/src", "packages/contracts"]
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!