diff --git a/docs/UI_MIGRATION.md b/docs/UI_MIGRATION.md index 5361d970..c82af071 100644 --- a/docs/UI_MIGRATION.md +++ b/docs/UI_MIGRATION.md @@ -600,3 +600,31 @@ mock 与 live 共享完整目录的前端筛选及分页逻辑。live 沿用 `/a - 单列 / 全选 / 重置只改草稿,确认后一次应用,至少保留一列;取消 / X / Esc / 遮罩均放弃草稿,关闭焦点返回入口;后台刷新不重置草稿。原默认列、角色过滤、存储键保留,渠道“自动封禁”仍默认隐藏,个人与企业密钥仍为页内状态。四个 hook AST 对照确认只暴露原 setter / 默认值,所有受影响文件的 API 调用不变;新校验文案补齐 9 个语言包。 - 验证:9 入口 × 浅深色 × 桌面 1920×916 / 窄屏 393×851,36/36 场景、324 组交互检查通过;普通用户权限、真实与模拟移动任务卡片字段、刷新保留草稿、不可配置键保留等补测 5/5;已有密钥搜索 / 重置 / 列设置用例桌面与移动 2/2。页面运行错误与非 GET API 请求均为 0。单元测试 291/291,变更文件 ESLint 0 错误 / 12 条既有警告,变更文件 Prettier 与 `git diff --check` 通过;全仓 ESLint 261 个错误 / 189 条警告及 677 个格式文件问题单列,不批量修改其他文件。 - 限制:真实 `/api/org/tasks` 仍返回 404,企业任务完整数据交互采用浏览器 mock 并明确标记。浏览器、截图、单元测试等重任务串行,持续记录物理内存与整机 CPU,未触发 2GB 内存压力阈值;产物只保存在忽略目录 `report/column-settings/`,入口 `index.html`。按用户要求未执行生产构建或生产写操作;工作区并发修改按用户确认保留。 + +## 合并引入的 Semi 组件迁移(2026-11-10) + +- 范围:仅限合入总仓库 weiyuan(bfdfb339)`web/` 新功能时带进来、仍直接引用 `@douyinfe/semi-ui` 或 `--semi-color-*` 的文件——创作台 `src/components/creation/**`(17 个组件 + 5 个 CSS + `CreationGuide.jsx`)、`components/settings/WeyAiSetting.jsx`、`pages/Organization/OrgResolver.jsx`、`pages/Setting/WeyAi/*`(4 个)。其他文件不改;业务逻辑、数据流、状态、API、路由不变。 +- 依赖:`package.json` / `package-lock.json` 早已无 Semi;迁移后源码无 `@douyinfe` 引用,构建产物含 Semi 的文件由 2 个降为 0。本地 `node_modules/@douyinfe` 仅为安装残留,可用 `npm prune` 清理。 +- 组件映射(在上方“组件映射”表之外的补充): + +| 原写法 | Ant Design 写法 | 位置 | +| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | +| `import … from '@douyinfe/semi-ui'` | `import … from '@/components/ui'` | 全部 23 个文件 | +| Popover `visible` + `trigger='custom'` + `onClickOutSide` / `onEscKeyDown` | `open` + `trigger='click'` + `onOpenChange(false)`(Esc 与嵌套浮层豁免用 antd 原生) | `CreationDock` DockPopover、`ModelPicker`、`WorkFeed/FilterBar` | +| Popover `contentClassName` | `classNames={{ body }}`(作用于 `.ant-popover-inner`) | 同上 | +| Dropdown `render` + `Dropdown.Title` | `menu.items` 中 `type: 'group'` | `CreationDock` 提示词历史 | +| Dropdown.Item `active` | `menu.selectable` + `selectedKeys` | `CreationDock` 模式切换 | +| Slider `tipFormatter` | `tooltip={{ formatter }}` | `params/ParamSlider.jsx` | +| `CheckboxGroup direction='horizontal'` | `Checkbox.Group`(默认横排) | `SettingsWeyAiContentEditor.jsx` | +| TagInput `max` | `maxCount` | `SettingsWeyAiContentEditor.jsx` | +| DatePicker `onChange(date)` | `onChange(_, date)`(适配层第二参为 Date,与 Semi 首参语义一致) | `SettingsWeyAiContentEditor.jsx`、`SettingsWeyAiReleaseNotes.jsx` | +| `Modal.confirm({ okButtonProps: { type: 'danger' } })` | `okButtonProps: { danger: true }` | `WorkFeed/WorkFeed.jsx` | +| `--semi-color-{primary,warning,danger,success,border,white}` | `--ui-color-*`(`UiThemeProvider` TokenBridge) | 创作台 CSS、WeyAi 设置 | +| `--semi-color-overlay-bg` | Ant Design 默认遮罩色 `rgba(0, 0, 0, 0.45)`(`colorBgMask`) | `creation-dock.css` 遮罩、`CreationGuide.jsx` | +| `.semi-select` / `.semi-input-wrapper` | `.ant-select` / `.ant-input-affix-wrapper` | `WorkFeed/work-feed.css` | +| 点击 `.semi-portal` 内不关闭弹层(`isInsideOtherPortal`) | 删除;由 antd 触发器嵌套浮层机制处理 | `CreationDock.jsx` | + +- 间距:Semi Popover 内容区无内边距,antd `.ant-popover-inner` 默认 12px。DockPopover 保留自身 `.cs-pop-body` 12px 并将 inner 置 0;FilterBar 去掉 `p-3` 包装改用 antd 默认 12px,视觉间距不变。 +- 已知视觉差异(遵循 Ant Design 默认,不自行设计替代效果):Ant Design 无 warning 按钮类型,`type='warning'`(创作台“升级 / 去充值”、版本说明“撤回”)分别按适配层显示为 primary / default;Badge 计数用 antd 默认色;`Text size='small'` 显示为默认字号;遮罩色由 Semi 深灰改为 antd 默认。 +- 风险:TagInput 的 `maxLength`(单个标签长度)在 antd tags 模式下不生效,前端输入不再截断,依赖后端 `max_len` 校验,未修改业务代码;本轮未做浏览器视觉回归,创作台弹层 / 抽屉 / 下拉与 WeyAi 设置页需人工过一遍浅深色与移动端。 +- 验证:单元测试 388/388;变更文件 ESLint 0 错误;构建通过;变更 CSS Prettier 通过(`CreationDock.jsx` 在合并前已存在的格式差异未顺带修改)。 diff --git a/src/components/creation/CompareSummary.jsx b/src/components/creation/CompareSummary.jsx index 88b82c77..c473d9a2 100644 --- a/src/components/creation/CompareSummary.jsx +++ b/src/components/creation/CompareSummary.jsx @@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import React from 'react'; -import { Button, Modal, Spin } from '@douyinfe/semi-ui'; +import { Button, Modal, Spin } from '@/components/ui'; import { AlertTriangle } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { compareParamSummary } from '../../hooks/creation/creationCompare'; diff --git a/src/components/creation/CreationDock.jsx b/src/components/creation/CreationDock.jsx index c5d65668..fe9386ba 100644 --- a/src/components/creation/CreationDock.jsx +++ b/src/components/creation/CreationDock.jsx @@ -35,7 +35,7 @@ import { Skeleton, TextArea, Tooltip, -} from '@douyinfe/semi-ui'; +} from '@/components/ui'; import { AlertCircle, ArrowLeft, @@ -161,10 +161,6 @@ const getStorage = () => { } }; -// 弹层内点击 Select 下拉等其他 portal 时不关闭弹层 -const isInsideOtherPortal = (e) => - Boolean(e?.target?.closest?.('.semi-portal, .semi-select-option-list')); - /** 估价文案:"预计 ¥x · 约 N 秒 · 失败自动退还";估价失败 → "价格以实际扣费为准"。 */ export const quoteText = ( t, @@ -275,15 +271,14 @@ const DockPopover = ({ } return ( { - if (!isInsideOtherPortal(e)) onClose(); + onOpenChange={(next) => { + if (!next) onClose(); }} - onEscKeyDown={onClose} - contentClassName={`cs-popover ${className}`} + classNames={{ body: `cs-popover ${className}` }} content={ open ? (
@@ -1122,28 +1117,25 @@ const CreationDock = ({ form, compare = null }) => { - {modeOptions.map((o) => ( - { - if (!o.disabled) setMode(o.mode); - }} - > - - {t(modeLabels[o.mode] || o.mode)} - {o.disabled && o.reason ? ( - {t(o.reason)} - ) : null} - - - ))} - - } + menu={{ + selectable: true, + selectedKeys: [mode], + items: modeOptions.map((o) => ({ + key: o.mode, + disabled: o.disabled, + onClick: () => { + if (!o.disabled) setMode(o.mode); + }, + label: ( + + {t(modeLabels[o.mode] || o.mode)} + {o.disabled && o.reason ? ( + {t(o.reason)} + ) : null} + + ), + })), + }} >
@@ -490,7 +489,7 @@ const SettingsWeyAiContentEditor = ({ set('end_at', toSec(d))} + onChange={(_, d) => set('end_at', toSec(d))} placeholder={t('不限')} /> diff --git a/src/pages/Setting/WeyAi/SettingsWeyAiContentStorage.jsx b/src/pages/Setting/WeyAi/SettingsWeyAiContentStorage.jsx index 77881500..c0f3240b 100644 --- a/src/pages/Setting/WeyAi/SettingsWeyAiContentStorage.jsx +++ b/src/pages/Setting/WeyAi/SettingsWeyAiContentStorage.jsx @@ -33,7 +33,7 @@ import { Spin, Switch, Typography, -} from '@douyinfe/semi-ui'; +} from '@/components/ui'; import { useTranslation } from 'react-i18next'; import { API, showError, showSuccess } from '../../../helpers'; diff --git a/src/pages/Setting/WeyAi/SettingsWeyAiReleaseNotes.jsx b/src/pages/Setting/WeyAi/SettingsWeyAiReleaseNotes.jsx index 2c70d4e2..193ec7ff 100644 --- a/src/pages/Setting/WeyAi/SettingsWeyAiReleaseNotes.jsx +++ b/src/pages/Setting/WeyAi/SettingsWeyAiReleaseNotes.jsx @@ -39,7 +39,7 @@ import { Tag, TextArea, Typography, -} from '@douyinfe/semi-ui'; +} from '@/components/ui'; import { useTranslation } from 'react-i18next'; import { API, showError, showSuccess } from '../../../helpers'; import MarkdownRenderer from '../../../components/common/markdown/MarkdownRenderer'; @@ -299,7 +299,7 @@ const SettingsWeyAiReleaseNotes = () => { ? new Date(draft.released_at * 1000) : undefined } - onChange={(date) => + onChange={(_, date) => setDraft({ ...draft, // Local noon: the same calendar day in every time zone within ±12 h. @@ -340,7 +340,7 @@ const SettingsWeyAiReleaseNotes = () => { className='mt-2 p-3 rounded' style={{ minHeight: 200, - border: '1px solid var(--semi-color-border)', + border: '1px solid var(--ui-color-border)', }} > {draft.content.trim() ? (