Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
project-starter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 93727beb
authored
Nov 18, 2026
by
venus
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(kernel): UI 组件统一改用 V* 前缀 - UButton/UAlert/useUMessage 等全量改名,内核 v2.0.0
1 parent
54f49730
Pipeline
#524
for
93727beb
failed
in 0 seconds
Changes
61
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
61 changed files
with
346 additions
and
335 deletions
.kernel/apps/shell/src/pages/Dashboard/index.tsx
.kernel/apps/shell/src/pages/Login/components/LoginForm.tsx
.kernel/apps/shell/src/pages/Login/index.tsx
.kernel/apps/shell/src/pages/NotFound/index.tsx
.kernel/apps/shell/src/pages/Profile/index.tsx
.kernel/apps/shell/src/router/RouteErrorBoundary.tsx
.kernel/kernel.json
.kernel/manifest.json
.kernel/packages/biz/src/components/CombiForm/index.tsx
.kernel/packages/biz/src/components/ConfirmModal/index.tsx
.kernel/packages/biz/src/components/DataTable/index.tsx
.kernel/packages/biz/src/components/SearchForm/index.tsx
.kernel/packages/biz/src/components/StatusTag.tsx
.kernel/packages/eslint-config/index.js
.kernel/packages/platform-core/src/access/ui/PermButton.tsx
.kernel/packages/platform-sdk/src/compat/access/ui/PermButton.tsx
.kernel/packages/ui/src/components/Alert/index.tsx
.kernel/packages/ui/src/components/App/Alert/index.tsx
.kernel/packages/ui/src/components/App/hooks.ts
.kernel/packages/ui/src/components/App/index.tsx
.kernel/packages/ui/src/components/Button/index.tsx
.kernel/packages/ui/src/components/Card/index.tsx
.kernel/packages/ui/src/components/Cascader/index.tsx
.kernel/packages/ui/src/components/Checkbox/index.tsx
.kernel/packages/ui/src/components/DatePicker/index.tsx
.kernel/packages/ui/src/components/Descriptions/index.tsx
.kernel/packages/ui/src/components/Drawer/index.tsx
.kernel/packages/ui/src/components/Dropdown/index.tsx
.kernel/packages/ui/src/components/Empty/index.tsx
.kernel/packages/ui/src/components/FillTable/index.tsx
.kernel/packages/ui/src/components/Form/index.tsx
.kernel/packages/ui/src/components/Image/index.tsx
.kernel/packages/ui/src/components/Input/index.tsx
.kernel/packages/ui/src/components/List/index.tsx
.kernel/packages/ui/src/components/Modal/index.tsx
.kernel/packages/ui/src/components/PageTransition/direction.ts
.kernel/packages/ui/src/components/PageTransition/index.tsx
.kernel/packages/ui/src/components/Popover/index.tsx
.kernel/packages/ui/src/components/Radio/index.tsx
.kernel/packages/ui/src/components/Result/index.tsx
.kernel/packages/ui/src/components/Select/index.tsx
.kernel/packages/ui/src/components/Steps/index.tsx
.kernel/packages/ui/src/components/Switch/index.tsx
.kernel/packages/ui/src/components/Table/imageCell.tsx
.kernel/packages/ui/src/components/Table/index.tsx
.kernel/packages/ui/src/components/Table/loading.tsx
.kernel/packages/ui/src/components/TableLoader/index.tsx
.kernel/packages/ui/src/components/Tabs/index.tsx
.kernel/packages/ui/src/components/Tag/index.tsx
.kernel/packages/ui/src/components/Timeline/index.tsx
.kernel/packages/ui/src/components/Tooltip/index.tsx
.kernel/packages/ui/src/components/Typography/index.tsx
.kernel/packages/ui/src/components/Upload/index.tsx
.kernel/packages/ui/src/index.ts
README.md
apps/example/src/App.tsx
apps/example/src/pages/AccountManage/components/AccountFormDrawer.tsx
apps/example/src/pages/AccountManage/index.tsx
apps/example/src/pages/RoleManage/components/RoleDetailDrawer.tsx
apps/example/src/pages/RoleManage/components/RoleFormDrawer.tsx
apps/example/src/pages/RoleManage/index.tsx
.kernel/apps/shell/src/pages/Dashboard/index.tsx
View file @
93727be
...
...
@@ -21,7 +21,7 @@ import {
KeyOutlined,
UserOutlined,
} from '@ant-design/icons';
import {
U
Button } from '@venus/ui';
import {
V
Button } from '@venus/ui';
import { useAppStore } from '@/store/useAppStore';
import { roleLabels, useAccess, type RoleKey } from '@/access';
import { WorkbenchBackdrop } from './WorkbenchBackdrop';
...
...
@@ -95,10 +95,10 @@ function ActionCard({
<p className="venus-wb-action__desc">{desc}</p>
{action && onClick ? (
<div className="venus-wb-action__foot">
<
U
Button type="link" onClick={onClick}>
<
V
Button type="link" onClick={onClick}>
{action}
<ArrowRightOutlined />
</
U
Button>
</
V
Button>
</div>
) : null}
</section>
...
...
.kernel/apps/shell/src/pages/Login/components/LoginForm.tsx
View file @
93727be
...
...
@@ -17,13 +17,13 @@ import { protocols as bizProtocols } from '@/protocols';
import { createLoginDeps, toMessageSink } from '../../../auth-deps';
import { executeLoginFlow, resolveLoginProtocols } from '@venus/platform-core';
import type { VenusSession } from '@venus/contracts';
import {
UButton, UForm, UFormItem, UInput, UTitle, U
Text } from '@venus/ui';
import {
VButton, VForm, VFormItem, VInput, VTitle, V
Text } from '@venus/ui';
export function LoginForm() {
const navigate = useNavigate();
const { message } = App.useApp();
const { applyLogin } = useAccess();
const [form] =
U
Form.useForm();
const [form] =
V
Form.useForm();
const [loading, setLoading] = useState(false);
// host 能力装配固定引用:协议实现常把它存进闭包,每次渲染换新对象会破坏缓存语义。
...
...
@@ -61,27 +61,27 @@ export function LoginForm() {
return (
<>
<
U
Title level={3} style={{ marginBottom: 4 }}>
<
V
Title level={3} style={{ marginBottom: 4 }}>
{brand.welcomeTitle}
</
U
Title>
<
UText type="secondary">{brand.welcomeDesc}</U
Text>
<
U
Form
</
V
Title>
<
VText type="secondary">{brand.welcomeDesc}</V
Text>
<
V
Form
form={form}
layout="vertical"
onFinish={onFinish}
style={{ marginTop: 24 }}
requiredMark={false}
>
<
U
FormItem name="account" label="账号" rules={[{ required: true, message: '请输入账号' }]}>
<
U
Input prefix={<UserOutlined />} placeholder="请输入账号" size="large" />
</
U
FormItem>
<
U
FormItem name="password" label="密码" rules={[{ required: true, message: '请输入密码' }]}>
<
U
Input.Password prefix={<LockOutlined />} placeholder="请输入密码" size="large" />
</
U
FormItem>
<
U
Button htmlType="submit" size="large" block loading={loading}>
<
V
FormItem name="account" label="账号" rules={[{ required: true, message: '请输入账号' }]}>
<
V
Input prefix={<UserOutlined />} placeholder="请输入账号" size="large" />
</
V
FormItem>
<
V
FormItem name="password" label="密码" rules={[{ required: true, message: '请输入密码' }]}>
<
V
Input.Password prefix={<LockOutlined />} placeholder="请输入密码" size="large" />
</
V
FormItem>
<
V
Button htmlType="submit" size="large" block loading={loading}>
登 录
</
U
Button>
</
U
Form>
</
V
Button>
</
V
Form>
{FormExtra ? <FormExtra /> : null}
</>
);
...
...
.kernel/apps/shell/src/pages/Login/index.tsx
View file @
93727be
import { LoginAside as DefaultLoginAside } from './components/LoginAside';
import { LoginForm } from './components/LoginForm';
import {
U
Text } from '@venus/ui';
import {
V
Text } from '@venus/ui';
import { brand } from '@/brand';
import { slots } from '@/slots';
/** 默认版权区;业务可用 slots.LoginFooter 整体替换。 */
function DefaultLoginFooter() {
return (
<
U
Text type="secondary" style={{ marginTop: 24, fontSize: 12 }}>
<
V
Text type="secondary" style={{ marginTop: 24, fontSize: 12 }}>
© {new Date().getFullYear()} {brand.copyrightName} · {brand.copyrightSuffix}
</
U
Text>
</
V
Text>
);
}
...
...
.kernel/apps/shell/src/pages/NotFound/index.tsx
View file @
93727be
import { useNavigate } from 'react-router-dom';
import {
UButton, U
Result } from '@venus/ui';
import {
VButton, V
Result } from '@venus/ui';
export default function NotFound() {
const nav = useNavigate();
return (
<
U
Result
<
V
Result
status="404"
title="404"
subTitle="页面不存在"
extra={<
UButton onClick={() => nav('/dashboard')}>返回工作台</U
Button>}
extra={<
VButton onClick={() => nav('/dashboard')}>返回工作台</V
Button>}
/>
);
}
.kernel/apps/shell/src/pages/Profile/index.tsx
View file @
93727be
...
...
@@ -5,7 +5,7 @@ import { useEffect, useState, type ReactNode } from 'react';
import { useNavigate } from 'react-router-dom';
import { App, Avatar, Tag } from 'antd';
import { UserOutlined } from '@ant-design/icons';
import {
UCard, UForm, UInput, UButton, UAlert, U
Text, Skeleton } from '@venus/ui';
import {
VCard, VForm, VInput, VButton, VAlert, V
Text, Skeleton } from '@venus/ui';
import { auth, type UserInfo } from '@/api';
import { useAppStore } from '@/store/useAppStore';
import { useAccess } from '@/access';
...
...
@@ -26,7 +26,7 @@ export default function Profile() {
const [info, setInfo] = useState<UserInfo | null>(null);
const [loading, setLoading] = useState(true);
const [submitting, setSubmitting] = useState(false);
const [form] =
U
Form.useForm<PasswordForm>();
const [form] =
V
Form.useForm<PasswordForm>();
useEffect(() => {
let alive = true;
...
...
@@ -67,7 +67,7 @@ export default function Profile() {
};
if (loading) return <Skeleton variant="detail" />;
if (!info) return <
UCard>{<UText type="secondary">暂无账号信息</UText>}</U
Card>;
if (!info) return <
VCard>{<VText type="secondary">暂无账号信息</VText>}</V
Card>;
const codes = info.roleCodes?.length ? info.roleCodes : roleCodes;
const detailRows: { label: string; value: ReactNode }[] = [
...
...
@@ -98,7 +98,7 @@ export default function Profile() {
return (
<div className="venus-profile">
{/* 顶部身份横幅(整宽) */}
<
U
Card
<
V
Card
className="venus-profile-hero"
styles={{
body: { padding: 0, background: 'linear-gradient(135deg,#f3f7ff 0%,#eaf0ff 100%)' },
...
...
@@ -109,9 +109,9 @@ export default function Profile() {
<Avatar size={64} className="venus-profile-avatar" icon={<UserOutlined />} />
<div>
<div className="venus-profile-name">{info.name}</div>
<
U
Text type="secondary" className="venus-profile-account">
<
V
Text type="secondary" className="venus-profile-account">
{info.account}
</
U
Text>
</
V
Text>
</div>
</div>
<div className="venus-profile-hero-meta">
...
...
@@ -123,12 +123,12 @@ export default function Profile() {
))}
</div>
</div>
</
U
Card>
</
V
Card>
{/* 下方双栏(等高) */}
<div className="venus-profile-grid">
{/* 左:账户详情 */}
<
U
Card
<
V
Card
className="venus-profile-info"
title={<span className="venus-profile-card-title">账户详情</span>}
styles={{ body: { padding: 20 } }}
...
...
@@ -144,29 +144,29 @@ export default function Profile() {
<div className="venus-profile-note">
账号信息由系统管理员维护,如需变更请联系管理员处理。
</div>
</
U
Card>
</
V
Card>
{/* 右:修改密码 */}
<
U
Card
<
V
Card
className="venus-profile-security"
title={<span className="venus-profile-card-title">修改密码</span>}
styles={{ body: { padding: 20 } }}
>
<
U
Alert
<
V
Alert
type="info"
showIcon
message="修改成功后当前登录令牌失效,需使用新密码重新登录。"
style={{ marginBottom: 18 }}
/>
<
U
Form form={form} layout="vertical" onFinish={onSubmit} style={{ maxWidth: 380 }}>
<
U
Form.Item
<
V
Form form={form} layout="vertical" onFinish={onSubmit} style={{ maxWidth: 380 }}>
<
V
Form.Item
name="oldPassword"
label="当前密码"
rules={[{ required: true, message: '请输入当前密码' }]}
>
<
U
Input.Password placeholder="请输入当前密码" autoComplete="current-password" />
</
U
Form.Item>
<
U
Form.Item
<
V
Input.Password placeholder="请输入当前密码" autoComplete="current-password" />
</
V
Form.Item>
<
V
Form.Item
name="newPassword"
label="新密码"
rules={[
...
...
@@ -180,9 +180,9 @@ export default function Profile() {
}),
]}
>
<
U
Input.Password placeholder="至少 8 位" autoComplete="new-password" />
</
U
Form.Item>
<
U
Form.Item
<
V
Input.Password placeholder="至少 8 位" autoComplete="new-password" />
</
V
Form.Item>
<
V
Form.Item
name="confirmPassword"
label="确认新密码"
dependencies={['newPassword']}
...
...
@@ -196,13 +196,13 @@ export default function Profile() {
}),
]}
>
<
U
Input.Password placeholder="请再次输入新密码" autoComplete="new-password" />
</
U
Form.Item>
<
U
Button htmlType="submit" loading={submitting}>
<
V
Input.Password placeholder="请再次输入新密码" autoComplete="new-password" />
</
V
Form.Item>
<
V
Button htmlType="submit" loading={submitting}>
确认修改
</
U
Button>
</
U
Form>
</
U
Card>
</
V
Button>
</
V
Form>
</
V
Card>
</div>
</div>
);
...
...
.kernel/apps/shell/src/router/RouteErrorBoundary.tsx
View file @
93727be
import { useEffect } from 'react';
import { useRouteError } from 'react-router-dom';
import {
UButton, U
Result } from '@venus/ui';
import {
VButton, V
Result } from '@venus/ui';
const RELOAD_KEY = 'venus:chunk-reload-attempted';
...
...
@@ -33,7 +33,7 @@ export default function RouteErrorBoundary() {
}, [resourceLoadFailed]);
return (
<
U
Result
<
V
Result
status="error"
title={resourceLoadFailed ? '页面资源加载失败' : '页面发生错误'}
subTitle={
...
...
@@ -41,7 +41,7 @@ export default function RouteErrorBoundary() {
? '请检查网络后刷新页面。如果仍无法打开,请联系管理员。'
: '请刷新页面重试。如果问题持续出现,请联系管理员。'
}
extra={<
UButton onClick={() => window.location.reload()}>刷新页面</U
Button>}
extra={<
VButton onClick={() => window.location.reload()}>刷新页面</V
Button>}
/>
);
}
.kernel/kernel.json
View file @
93727be
{
"name"
:
"venus-kernel"
,
"version"
:
"
1.5
.0"
,
"version"
:
"
2.0
.0"
,
"description"
:
"VENUS 微前端基座内核。派生应用通过 venus kernel upgrade 升级,禁止直接修改 .kernel/ 下文件。"
,
"minCliVersion"
:
"1.0.0"
,
"minKernelVersion"
:
"1.0.0"
,
...
...
@@ -53,6 +53,17 @@
"首次部署跑 pnpm release:all;日常增量跑 pnpm release:dev|test(按各 package.json.version 与线上清单比对);回滚加 --switch-only"
,
"deploy/ 属于业务区,内核升级不覆盖;发布前需在 nginx 给 /mfe/manifest.json 与 /index.html 配 Cache-Control: no-cache"
]
},
{
"from"
:
"1.5.0"
,
"to"
:
"2.0.0"
,
"summary"
:
"UI 组件统一改用 V* 前缀(venus 首字母):UButton→VButton、UTable→VTable、useUMessage→useVMessage 等;不再保留 U* 兼容别名"
,
"manual"
:
[
"破坏性:@venus/ui 的所有 U* 组件/类型/hooks 已改名 V*,无兼容别名。升级后需把业务代码里的 import 与 JSX 标签统一替换(U→V,useUApp→useVApp、useUMessage→useVMessage)"
,
"机械替换即可:全词匹配 U<大写字母> 前缀改为 V<大写字母>;注意只改组件名,不要动 URL/UI/UUID 等普通单词"
,
"子应用仍需从 @venus/ui 消费组件,禁止直引 antd(eslint 门禁提示文案已同步为 V*)"
],
"breaking"
:
true
}
],
"protectedDir"
:
".kernel/"
,
...
...
.kernel/manifest.json
View file @
93727be
This diff is collapsed.
Click to expand it.
.kernel/packages/biz/src/components/CombiForm/index.tsx
View file @
93727be
import type { CSSProperties, ReactNode } from 'react';
import type { FormInstance, FormProps } from 'antd';
import {
UCascader, UDescriptions, UForm, UFormItem, UInput, USelect, U
Switch } from '@venus/ui';
import {
VCascader, VDescriptions, VForm, VFormItem, VInput, VSelect, V
Switch } from '@venus/ui';
import type { FieldSchema } from '../formSchema';
export interface CombiFormProps<T extends Record<string, unknown>> {
...
...
@@ -40,9 +40,9 @@ export function CombiForm<T extends Record<string, unknown>>({
labelWidth,
labelAlign = 'right',
}: CombiFormProps<T>) {
const [innerForm] =
U
Form.useForm<T>();
const [innerForm] =
V
Form.useForm<T>();
const form = externalForm ?? innerForm;
const values =
U
Form.useWatch([], form) as T | undefined;
const values =
V
Form.useWatch([], form) as T | undefined;
// 详情模式只展示调用方传入的数据;空的内部表单状态不能覆盖接口返回的详情值。
const data = (mode === 'detail' ? initialValues : (values ?? initialValues ?? {})) as T;
const visible = fields.filter(
...
...
@@ -50,7 +50,7 @@ export function CombiForm<T extends Record<string, unknown>>({
);
if (mode === 'detail')
return (
<
U
Descriptions
<
V
Descriptions
column={detailColumns}
styles={
labelWidth === undefined
...
...
@@ -79,7 +79,7 @@ export function CombiForm<T extends Record<string, unknown>>({
const disabled = typeof field.disabled === 'function' ? field.disabled(data) : field.disabled;
if (field.type === 'cascader')
return (
<
U
Cascader
<
V
Cascader
options={field.options}
disabled={disabled}
style={{ width: '100%' }}
...
...
@@ -88,7 +88,7 @@ export function CombiForm<T extends Record<string, unknown>>({
);
if (field.type === 'select' || field.type === 'selectMultiple')
return (
<
U
Select
<
V
Select
options={field.options}
mode={field.type === 'selectMultiple' ? 'multiple' : undefined}
placeholder={
...
...
@@ -100,21 +100,21 @@ export function CombiForm<T extends Record<string, unknown>>({
{...field.selectProps}
/>
);
if (field.type === 'switch') return <
U
Switch disabled={disabled} />;
if (field.type === 'switch') return <
V
Switch disabled={disabled} />;
if (field.type === 'textarea')
return (
<
U
Input.TextArea
<
V
Input.TextArea
disabled={disabled}
placeholder={inputPlaceholder(field)}
{...field.textareaProps}
/>
);
return (
<
U
Input disabled={disabled} placeholder={inputPlaceholder(field)} {...field.inputProps} />
<
V
Input disabled={disabled} placeholder={inputPlaceholder(field)} {...field.inputProps} />
);
};
return (
<
U
Form
<
V
Form
form={form}
initialValues={initialValues}
layout={layout}
...
...
@@ -129,7 +129,7 @@ export function CombiForm<T extends Record<string, unknown>>({
{section.title ? renderSectionTitle?.(section.title) : null}
<div style={sectionContentStyle}>
{section.fields.map((field) => (
<
U
FormItem
<
V
FormItem
key={field.name}
name={field.name as string}
label={field.label}
...
...
@@ -138,12 +138,12 @@ export function CombiForm<T extends Record<string, unknown>>({
normalize={field.normalize}
>
{renderControl?.(field, form, data) ?? defaultControl(field)}
</
U
FormItem>
</
V
FormItem>
))}
</div>
</section>
))}
</
U
Form>
</
V
Form>
);
}
...
...
.kernel/packages/biz/src/components/ConfirmModal/index.tsx
View file @
93727be
import type { ReactNode } from 'react';
import {
U
Modal } from '@venus/ui';
import {
V
Modal } from '@venus/ui';
export interface ConfirmModalProps {
open: boolean;
...
...
@@ -26,7 +26,7 @@ export function ConfirmModal({
onConfirm,
}: ConfirmModalProps) {
return (
<
U
Modal
<
V
Modal
open={open}
title={title}
width={width}
...
...
@@ -37,6 +37,6 @@ export function ConfirmModal({
onOk={onConfirm}
>
<div style={{ padding: '8px 0 24px' }}>{content}</div>
</
U
Modal>
</
V
Modal>
);
}
.kernel/packages/biz/src/components/DataTable/index.tsx
View file @
93727be
import { useLayoutEffect, useRef, useState } from 'react';
import type { CSSProperties, ReactNode } from 'react';
import type { ColumnsType, TableProps } from 'antd/es/table';
import {
UButton, UTable, UTooltip, U
ExportIcon, FillTable } from '@venus/ui';
import {
VButton, VTable, VTooltip, V
ExportIcon, FillTable } from '@venus/ui';
import { PermButton } from '@/access';
import type { ActionSchema } from '../formSchema';
...
...
@@ -155,7 +155,7 @@ export function DataTable<T extends object>({
onClick,
type: isExport ? ('default' as const) : type,
size: 'small' as const,
icon: isExport ? <
U
ExportIcon /> : undefined,
icon: isExport ? <
V
ExportIcon /> : undefined,
className: isRowAction
? undefined
: isExport
...
...
@@ -173,9 +173,9 @@ export function DataTable<T extends object>({
{content}
</PermButton>
) : (
<
U
Button key={key} {...buttonProps}>
<
V
Button key={key} {...buttonProps}>
{content}
</
U
Button>
</
V
Button>
);
};
// 操作列宽由「内容」决定,页面传值降级为下限建议。
...
...
@@ -239,7 +239,7 @@ export function DataTable<T extends object>({
// 统一注入默认列宽 + 默认省略能力后再算最小宽度,scroll.x 与列宽始终一致。
const tableColumns = withLineLimit(sourceColumns, defaultColumnWidth);
const minTableWidth = getMinimumTableWidth(tableColumns, defaultColumnWidth);
const TableComponent = fillHeight ? FillTable<T> :
U
Table<T>;
const TableComponent = fillHeight ? FillTable<T> :
V
Table<T>;
return (
<>
{toolbarTitle || actions?.length || toolbarExtra ? (
...
...
@@ -327,7 +327,7 @@ function estimateActionWidth<T extends object>(actions?: RowActionSchema<T>[]):
* - line=0:显式禁用省略,内容原样。
* - line>0:按指定行数强制截断(兼容既有 line:1 / line:2 配置)。
* - 未配置:智能默认 —— 纯文本(string/number)单行省略;
* JSX(
U
Tag / 链接 / 按钮 / venus-code 等带样式节点)原样返回,避免 toCellContent 剥掉样式。
* JSX(
V
Tag / 链接 / 按钮 / venus-code 等带样式节点)原样返回,避免 toCellContent 剥掉样式。
* 只有实际溢出被省略时才由 EllipsisText 挂完整 tip;没省略的列不挂。
* 内部生成的序号列、操作列不参与省略包装。
*/
...
...
@@ -388,7 +388,7 @@ function withLineLimit<T extends object>(
* 省略列:只有内容确实被截断时才挂 tip。
* 单行比对 scrollWidth/clientWidth,多行比对 scrollHeight/clientHeight(+1 容忍亚像素取整);
* ResizeObserver 监听列宽变化,避免固定布局下窗口缩放后提示状态失真。
* 保持始终渲染
U
Tooltip(title=null 即无提示)以稳定 span 的 DOM 节点和 ref。
* 保持始终渲染
V
Tooltip(title=null 即无提示)以稳定 span 的 DOM 节点和 ref。
*/
function EllipsisText({
line,
...
...
@@ -419,11 +419,11 @@ function EllipsisText({
}, [line, children]);
return (
<
U
Tooltip title={truncated ? title : null}>
<
V
Tooltip title={truncated ? title : null}>
<span ref={spanRef} style={lineStyle(line)}>
{children}
</span>
</
U
Tooltip>
</
V
Tooltip>
);
}
...
...
.kernel/packages/biz/src/components/SearchForm/index.tsx
View file @
93727be
import { useEffect, useRef, useState } from 'react';
import {
U
Cascader,
U
Button,
U
DatePicker,
U
Form,
U
FormItem,
U
Input,
U
Popover,
U
Radio,
U
Select,
V
Cascader,
V
Button,
V
DatePicker,
V
Form,
V
FormItem,
V
Input,
V
Popover,
V
Radio,
V
Select,
} from '@venus/ui';
import type { FieldOption, FieldSchema } from '../formSchema';
import { DEFAULT_PAGE_SIZE } from '../DataTable';
...
...
@@ -70,7 +70,7 @@ export function SearchForm<T extends Record<string, unknown>>({
className,
defaultExpanded = false,
}: SearchFormProps<T>) {
const [form] =
U
Form.useForm();
const [form] =
V
Form.useForm();
// 普通单选下拉以空值代表「全部」。除了补选项外,也要把未指定的初始值设为空,
// 否则组件只会显示占位状态,看起来像没有选中「全部」。
const formInitialValues = fields.reduce<Record<string, unknown>>(
...
...
@@ -84,7 +84,7 @@ export function SearchForm<T extends Record<string, unknown>>({
) as Partial<T>;
// 空数组 = 监听整张表单。用于「收起状态下已设条件」的角标计数与悬浮卡:
// 收起了不等于没生效,用户必须看得见自己身上还挂着几个条件、分别是什么。
const values =
U
Form.useWatch([], form) as Partial<T> | undefined;
const values =
V
Form.useWatch([], form) as Partial<T> | undefined;
const [expanded, setExpanded] = useState(defaultExpanded);
const [activePopoverOpen, setActivePopoverOpen] = useState(false);
// 触发区只有主色实心的「已填数」角标。antd Popover 的 hover 触发器绑在 children 上时,
...
...
@@ -242,9 +242,9 @@ export function SearchForm<T extends Record<string, unknown>>({
</div>
<div className="venus-filter-active__foot">
<span className="venus-filter-active__hint">点 × 移除单项</span>
<
U
Button type="default" size="small" danger onClick={clearAllConditions}>
<
V
Button type="default" size="small" danger onClick={clearAllConditions}>
全部清空
</
U
Button>
</
V
Button>
</div>
</div>
);
...
...
@@ -266,7 +266,7 @@ export function SearchForm<T extends Record<string, unknown>>({
const options = field.options ?? [];
const hasAllOption = options.some((option) => option.label === '全部' || option.value === '');
return (
<
U
Select
<
V
Select
{...common}
allowClear={false}
style={{ width }}
...
...
@@ -281,41 +281,41 @@ export function SearchForm<T extends Record<string, unknown>>({
);
}
if (field.type === 'cascader')
return <
U
Cascader {...common} style={{ width }} options={field.options} allowClear={false} />;
if (field.type === 'date') return <
U
DatePicker {...common} style={{ width }} />;
return <
V
Cascader {...common} style={{ width }} options={field.options} allowClear={false} />;
if (field.type === 'date') return <
V
DatePicker {...common} style={{ width }} />;
if (field.type === 'dateRange') {
const picker = <
U
DatePicker.RangePicker disabled={common.disabled} style={{ width }} />;
const picker = <
V
DatePicker.RangePicker disabled={common.disabled} style={{ width }} />;
if (!field.selector) return picker;
return (
<div style={{ display: 'flex', width, minWidth: 0 }}>
<
U
FormItem name={field.selector.name as string} noStyle>
<
U
Select
<
V
FormItem name={field.selector.name as string} noStyle>
<
V
Select
allowClear={false}
style={{ width: 165, flex: '0 0 165px' }}
options={field.selector.options}
/>
</
U
FormItem>
</
V
FormItem>
<div style={{ minWidth: 0, flex: 1 }}>{picker}</div>
</div>
);
}
if (field.type === 'radio') return <
U
Radio.Group {...common} options={field.options} />;
if (field.type === 'radio') return <
V
Radio.Group {...common} options={field.options} />;
const input =
field.type === 'textarea' ? (
<
U
Input.TextArea {...common} style={{ width }} />
<
V
Input.TextArea {...common} style={{ width }} />
) : (
<
U
Input {...common} style={{ width }} />
<
V
Input {...common} style={{ width }} />
);
if (!field.selector) return input;
return (
<div style={{ display: 'flex', width, minWidth: 0 }}>
<
U
FormItem name={field.selector.name as string} noStyle>
<
U
Select
<
V
FormItem name={field.selector.name as string} noStyle>
<
V
Select
allowClear={false}
style={{ width: 140, flex: '0 0 140px' }}
options={field.selector.options}
/>
</
U
FormItem>
</
V
FormItem>
<div style={{ minWidth: 0, flex: 1 }}>{input}</div>
</div>
);
...
...
@@ -331,14 +331,14 @@ export function SearchForm<T extends Record<string, unknown>>({
const style: React.CSSProperties = { marginBottom: 0, minWidth: 0 };
if (span > 1) style.gridColumn = `span ${span}`;
return (
<
U
FormItem key={field.name} name={field.name as string} label={field.label} style={style}>
<
V
FormItem key={field.name} name={field.name as string} label={field.label} style={style}>
{control(field)}
</
U
FormItem>
</
V
FormItem>
);
};
return (
<
U
Form
<
V
Form
form={form}
initialValues={formInitialValues}
// 标签在左、控件在右:标签列宽固定,四组控件的左缘落在同一条竖线上。
...
...
@@ -357,7 +357,7 @@ export function SearchForm<T extends Record<string, unknown>>({
<div className="venus-filter-actions">
{hasExtra ? (
<
U
Button
<
V
Button
type="text"
size="small"
className="venus-filter-more-btn"
...
...
@@ -381,7 +381,7 @@ export function SearchForm<T extends Record<string, unknown>>({
) : null}
</span>
{activeFilterCount > 0 ? (
<
U
Popover
<
V
Popover
// 触发区是主色实心的「已填数」角标:无背景的总数上标、按钮文案都不触发。
// 开/关由角标自己的 mouse/focus 事件控制,不给 Popover 留触发方式,
// 否则点击按钮也会经由 onOpenChange 把它打开。
...
...
@@ -405,19 +405,19 @@ export function SearchForm<T extends Record<string, unknown>>({
>
{activeFilterCount}
</span>
</
U
Popover>
</
V
Popover>
) : null}
<span className={`venus-filter-toggle-icon${expanded ? ' is-open' : ''}`} aria-hidden>
▾
</span>
</
U
Button>
</
V
Button>
) : null}
<
U
Button type="default" size="small" onClick={clearAllConditions}>
<
V
Button type="default" size="small" onClick={clearAllConditions}>
重置
</
U
Button>
<
U
Button size="small" htmlType="submit">
</
V
Button>
<
V
Button size="small" htmlType="submit">
查询
</
U
Button>
</
V
Button>
</div>
</div>
...
...
@@ -428,7 +428,7 @@ export function SearchForm<T extends Record<string, unknown>>({
{extraFields.map(renderField)}
</div>
) : null}
</
U
Form>
</
V
Form>
);
}
...
...
.kernel/packages/biz/src/components/StatusTag.tsx
View file @
93727be
import {
U
Tag } from '@venus/ui';
import {
V
Tag } from '@venus/ui';
import { STORE_STATUS, type StoreStatus } from '@/config/storeStatus';
/** 门店状态徽标(对应 PRD §4.2 状态规范) */
export function StatusTag({ status }: { status?: StoreStatus | string | null }) {
const meta = STORE_STATUS[status as StoreStatus] ?? { label: status || '—', color: 'default' };
return (
<
U
Tag color={meta.color} style={{ marginInlineEnd: 0, borderRadius: 6 }}>
<
V
Tag color={meta.color} style={{ marginInlineEnd: 0, borderRadius: 6 }}>
{meta.label}
</
U
Tag>
</
V
Tag>
);
}
.kernel/packages/eslint-config/index.js
View file @
93727be
...
...
@@ -59,7 +59,7 @@ export const app = (options = {}) =>
group
:
[
'antd'
,
'antd/*'
],
allowTypeImports
:
true
,
message
:
'子应用必须经 @venus/ui 消费组件(
UAlert / UTable / useUMessage …)。缺组件就往 packages/ui 补一个 U
** 再引用,不要绕过共享层直接用 antd。'
,
'子应用必须经 @venus/ui 消费组件(
VAlert / VTable / useVMessage …)。缺组件就往 packages/ui 补一个 V
** 再引用,不要绕过共享层直接用 antd。'
,
},
],
},
...
...
.kernel/packages/platform-core/src/access/ui/PermButton.tsx
View file @
93727be
import { forwardRef } from 'react';
import {
UButton, UTooltip, type U
ButtonProps } from '@venus/ui';
import {
VButton, VTooltip, type V
ButtonProps } from '@venus/ui';
import { useAccess } from '../runtime/AccessProvider';
interface PermButtonProps extends
U
ButtonProps {
interface PermButtonProps extends
V
ButtonProps {
/** 所需权限点,如 'store:approve:pass';无该权限时按 fallback 处理 */
permission: string;
/** 无权限时的表现:'hide' 不渲染(默认)| 'disabled' 渲染禁用态 */
...
...
@@ -23,7 +23,7 @@ export const PermButton = forwardRef<HTMLButtonElement, PermButtonProps>(
if (!ok && fallback === 'hide') return null;
const btn = (
<
U
Button
<
V
Button
ref={ref}
{...rest}
disabled={!ok || rest.disabled}
...
...
@@ -32,7 +32,7 @@ export const PermButton = forwardRef<HTMLButtonElement, PermButtonProps>(
);
if (!ok && fallback === 'disabled' && unauthorizedTip) {
return <
UTooltip title={unauthorizedTip}>{btn}</U
Tooltip>;
return <
VTooltip title={unauthorizedTip}>{btn}</V
Tooltip>;
}
return btn;
},
...
...
.kernel/packages/platform-sdk/src/compat/access/ui/PermButton.tsx
View file @
93727be
import { forwardRef } from 'react';
import {
UButton, UTooltip, type U
ButtonProps } from '@venus/ui';
import {
VButton, VTooltip, type V
ButtonProps } from '@venus/ui';
import { useAccess } from '../runtime/AccessProvider';
interface PermButtonProps extends
U
ButtonProps {
interface PermButtonProps extends
V
ButtonProps {
/** 所需权限点,如 'store:approve:pass';无该权限时按 fallback 处理 */
permission: string;
/** 无权限时的表现:'hide' 不渲染(默认)| 'disabled' 渲染禁用态 */
...
...
@@ -23,7 +23,7 @@ export const PermButton = forwardRef<HTMLButtonElement, PermButtonProps>(
if (!ok && fallback === 'hide') return null;
const btn = (
<
U
Button
<
V
Button
ref={ref}
{...rest}
disabled={!ok || rest.disabled}
...
...
@@ -32,7 +32,7 @@ export const PermButton = forwardRef<HTMLButtonElement, PermButtonProps>(
);
if (!ok && fallback === 'disabled' && unauthorizedTip) {
return <
UTooltip title={unauthorizedTip}>{btn}</U
Tooltip>;
return <
VTooltip title={unauthorizedTip}>{btn}</V
Tooltip>;
}
return btn;
},
...
...
.kernel/packages/ui/src/components/Alert/index.tsx
View file @
93727be
import { Alert, type AlertProps } from 'antd';
export type
U
AlertProps = AlertProps;
export type
V
AlertProps = AlertProps;
/**
* 项目提示条。
* 淡底与淡描边由 themeConfig 的 color*Bg / color*Border 别名统一给出,
* 不在页面里为每种状态各写一套背景色。
*/
export function
UAlert({ className, ...rest }: U
AlertProps) {
export function
VAlert({ className, ...rest }: V
AlertProps) {
return <Alert className={['uj-alert', className].filter(Boolean).join(' ')} {...rest} />;
}
.kernel/packages/ui/src/components/App/Alert/index.tsx
View file @
93727be
import { Alert, type AlertProps } from 'antd';
export type
U
AlertProps = AlertProps;
export type
V
AlertProps = AlertProps;
/**
* 项目提示条。
* 淡底与淡描边由 themeConfig 的 color*Bg / color*Border 别名统一给出,
* 不在页面里为每种状态各写一套背景色。
*/
export function
UAlert({ className, ...rest }: U
AlertProps) {
export function
VAlert({ className, ...rest }: V
AlertProps) {
return <Alert className={['venus-alert', className].filter(Boolean).join(' ')} {...rest} />;
}
.kernel/packages/ui/src/components/App/hooks.ts
View file @
93727be
...
...
@@ -2,7 +2,7 @@ import { App as AntApp } from 'antd';
import
{
useMemo
}
from
'react'
;
/** 取当前 App 边界上的 message / notification / modal 实例。 */
export
function
use
U
App
()
{
export
function
use
V
App
()
{
return
AntApp
.
useApp
();
}
...
...
@@ -11,7 +11,7 @@ export function useUApp() {
* 返回的实例走 ConfigProvider 的主题与 locale,静态 message.xxx 拿不到,
* 在 wujie 的 shadowRoot 内还会挂到文档 body 上、脱离子应用样式作用域。
*/
export
function
use
U
Message
()
{
const
{
message
}
=
use
U
App
();
export
function
use
V
Message
()
{
const
{
message
}
=
use
V
App
();
return
useMemo
(()
=>
message
,
[
message
]);
}
.kernel/packages/ui/src/components/App/index.tsx
View file @
93727be
import { App as AntApp, type AppProps } from 'antd';
export type
U
AppProps = AppProps;
export type
V
AppProps = AppProps;
/**
* 项目统一的 antd App 边界。
*
* 为什么要单独封一层:`import { App } from 'antd'` 在三个子应用里出现了 14 次,
* 目的全是拿 `App.useApp()` 的 message/notification —— 但那意味着每个页面都直接认识 antd。
* 子应用不许直引 antd(eslint 门禁),入口层由 @venus/ui 承担,页面只认 use
U
App。
* 子应用不许直引 antd(eslint 门禁),入口层由 @venus/ui 承担,页面只认 use
V
App。
*
* 挂载点在 platform-sdk 的 SubAppProvider 里(那里是唯一的 ConfigProvider + App 边界),
* 本组件只给需要显式声明边界的场景用,行为与 antd App 一致。
*/
export function
UApp(props: U
AppProps) {
export function
VApp(props: V
AppProps) {
return <AntApp {...props} />;
}
.kernel/packages/ui/src/components/Button/index.tsx
View file @
93727be
import { Button, type ButtonProps } from 'antd';
import { forwardRef } from 'react';
export type
U
ButtonProps = ButtonProps;
export type
V
ButtonProps = ButtonProps;
/**
* 项目统一按钮。约定主操作默认 primary、统一尺寸 middle,
* 仍可通过 props 覆盖。后续可在此注入埋点/权限/loading 自动处理等横切逻辑。
*/
export const
UButton = forwardRef<HTMLButtonElement, U
ButtonProps>(
export const
VButton = forwardRef<HTMLButtonElement, V
ButtonProps>(
({ type = 'primary', size = 'middle', ...rest }, ref) => (
<Button ref={ref} type={type} size={size} {...rest} />
),
);
UButton.displayName = 'U
Button';
VButton.displayName = 'V
Button';
.kernel/packages/ui/src/components/Card/index.tsx
View file @
93727be
import { Card, type CardProps } from 'antd';
export type
U
CardProps = CardProps & {
export type
V
CardProps = CardProps & {
/**
* 铺满父容器剩余高度,内部由表体自己滚动(列表页用)。
* 只是往根节点加一格布局类,不改 Card 的 DOM 结构,所以 antd 的尺寸计算不受影响。
...
...
@@ -12,13 +12,13 @@ export type UCardProps = CardProps & {
* 项目卡片容器。
*
* 与旧版的关键差异:默认 variant="borderless"。卡片靠「浅底 + 柔影」分层,
* 再叠一圈实描边会让每块内容都多一条硬线 —— 三个子应用原来既在
U
Card 外
* 再叠一圈实描边会让每块内容都多一条硬线 —— 三个子应用原来既在
V
Card 外
* 又各自写一遍 border + box-shadow(store-filter-card / venus-points-table-card),
* 阴影值还被旧令牌覆盖成单层弱影,所以子应用的卡片一直比主壳「平」。
*
* 需要表达「可点击 / 选中」时才显式传 variant="outlined"。
*/
export function
UCard({ variant = 'borderless', fill, className, ...rest }: U
CardProps) {
export function
VCard({ variant = 'borderless', fill, className, ...rest }: V
CardProps) {
return (
<Card
variant={variant}
...
...
.kernel/packages/ui/src/components/Cascader/index.tsx
View file @
93727be
import { Cascader, type CascaderProps } from 'antd';
import type { DefaultOptionType } from 'antd/es/cascader';
export type
U
CascaderProps = CascaderProps<DefaultOptionType, keyof DefaultOptionType, false>;
export type
V
CascaderProps = CascaderProps<DefaultOptionType, keyof DefaultOptionType, false>;
/** 项目统一级联选择。 */
export function
UCascader(props: U
CascaderProps) {
export function
VCascader(props: V
CascaderProps) {
return <Cascader {...props} />;
}
.kernel/packages/ui/src/components/Checkbox/index.tsx
View file @
93727be
import { Checkbox } from 'antd';
/** 项目统一多选框,透传 antd Checkbox。 */
export const
U
Checkbox = Checkbox;
export const
V
Checkbox = Checkbox;
export default
U
Checkbox;
export default
V
Checkbox;
.kernel/packages/ui/src/components/DatePicker/index.tsx
View file @
93727be
import { DatePicker, type DatePickerProps } from 'antd';
export type
U
DatePickerProps = DatePickerProps;
export type
V
DatePickerProps = DatePickerProps;
export const
UDatePicker = Object.assign((props: U
DatePickerProps) => <DatePicker {...props} />, {
export const
VDatePicker = Object.assign((props: V
DatePickerProps) => <DatePicker {...props} />, {
RangePicker: DatePicker.RangePicker,
});
.kernel/packages/ui/src/components/Descriptions/index.tsx
View file @
93727be
import { Descriptions, type DescriptionsProps } from 'antd';
export type
U
DescriptionsProps = DescriptionsProps;
export const
U
Descriptions = Object.assign(
(props:
U
DescriptionsProps) => <Descriptions {...props} />,
export type
V
DescriptionsProps = DescriptionsProps;
export const
V
Descriptions = Object.assign(
(props:
V
DescriptionsProps) => <Descriptions {...props} />,
{
Item: Descriptions.Item,
},
...
...
.kernel/packages/ui/src/components/Drawer/index.tsx
View file @
93727be
import { Drawer, type DrawerProps } from 'antd';
export type
U
DrawerProps = DrawerProps;
export type
V
DrawerProps = DrawerProps;
/**
* Unified detail drawer; responsive width and lifecycle defaults remain overridable.
* 约定:footer 里的取消/关闭按钮一律 type="default"(
U
Button 默认 primary,
* 约定:footer 里的取消/关闭按钮一律 type="default"(
V
Button 默认 primary,
* 不显式写就是主色)—— antd v6 的 Drawer 已无内置 footer 按钮,约定只能落在调用点。
*/
export function
UDrawer({ size = 760, destroyOnHidden = true, styles, ...props }: U
DrawerProps) {
export function
VDrawer({ size = 760, destroyOnHidden = true, styles, ...props }: V
DrawerProps) {
return (
<Drawer
size={size}
...
...
.kernel/packages/ui/src/components/Dropdown/index.tsx
View file @
93727be
import { Dropdown, type DropdownProps } from 'antd';
export type
U
DropdownProps = DropdownProps;
export type
V
DropdownProps = DropdownProps;
/**
* 项目统一下拉菜单。
* 触发方式、placement 一律沿用 antd 默认,不在这一层改行为 —— 封装只为收口引用入口,
* 让「能不能从 antd 直引」这条门禁在子应用里可以强制生效。
*/
export function
UDropdown(props: U
DropdownProps) {
export function
VDropdown(props: V
DropdownProps) {
return <Dropdown {...props} />;
}
.kernel/packages/ui/src/components/Empty/index.tsx
View file @
93727be
import { Empty, type EmptyProps } from 'antd';
export type
U
EmptyProps = EmptyProps;
export type
V
EmptyProps = EmptyProps;
/**
* 项目统一空态。
...
...
@@ -12,6 +12,6 @@ export type UEmptyProps = EmptyProps;
* 本组件是那份统一入口;空态撑满表体的行为在 Table 的 locale 里注入,见 ui.css 的
* .venus-table-fill 一节。
*/
export function
UEmpty({ image = Empty.PRESENTED_IMAGE_SIMPLE, ...rest }: U
EmptyProps) {
export function
VEmpty({ image = Empty.PRESENTED_IMAGE_SIMPLE, ...rest }: V
EmptyProps) {
return <Empty image={image} {...rest} />;
}
.kernel/packages/ui/src/components/FillTable/index.tsx
View file @
93727be
...
...
@@ -34,7 +34,7 @@ export function FillTable<T extends object = Record<string, unknown>>(props: Tab
<Table
key={`venus-fill-${remeasureEpoch}`}
{...props}
// 与
U
Table 共用同一个注入点,图片单元格能力在底层表格统一收口。
// 与
V
Table 共用同一个注入点,图片单元格能力在底层表格统一收口。
columns={withImageCell(props.columns)}
loading={resolveTableLoading(props.loading)}
rootClassName="venus-table"
...
...
.kernel/packages/ui/src/components/Form/index.tsx
View file @
93727be
...
...
@@ -6,7 +6,7 @@ import type { FC } from 'react';
* 注:antd 6 的 Form 为泛型组件,JSX 直接透传时类型较严格,此处将底层实现显式标注为 FC<FormProps>。 */
const AntForm = Form as unknown as FC<FormProps>;
export const
U
Form = Object.assign(
export const
V
Form = Object.assign(
(props: FormProps) => <AntForm {...props} layout={props.layout ?? 'vertical'} />,
{
Item: Form.Item,
...
...
@@ -16,6 +16,6 @@ export const UForm = Object.assign(
},
);
export const
U
FormItem = Form.Item;
export const
V
FormItem = Form.Item;
export default
U
Form;
export default
V
Form;
.kernel/packages/ui/src/components/Image/index.tsx
View file @
93727be
import { Image, type ImageProps } from 'antd';
export type
U
ImageProps = ImageProps;
export type
V
ImageProps = ImageProps;
/**
* 项目图片组件:antd Image 的
U
* 出口。
* 项目图片组件:antd Image 的
V
* 出口。
*
* 默认开启点击预览大图(antd 原生 preview 带缩放/旋转/翻页),
* 对齐源系统列表缩略图点击弹 image-viewer 的行为。
...
...
@@ -13,6 +13,6 @@ export type UImageProps = ImageProps;
* antd 自带 `.ant-image-img { width:100%; height:auto }` 与业务 class 同特异性,
* 故 object-fit 走 styles.image(inline)确保覆盖,不依赖 CSS 注入顺序。
*/
export function
UImage({ preview = true, ...rest }: U
ImageProps) {
export function
VImage({ preview = true, ...rest }: V
ImageProps) {
return <Image preview={preview} {...rest} />;
}
.kernel/packages/ui/src/components/Input/index.tsx
View file @
93727be
import { Input, type InputProps, type InputRef } from 'antd';
import { forwardRef } from 'react';
export type
U
InputProps = InputProps;
export type
V
InputProps = InputProps;
/** 项目统一输入框,默认开启 allowClear。 */
const
UInputBase = forwardRef<InputRef, U
InputProps>(({ allowClear = true, ...rest }, ref) => (
const
VInputBase = forwardRef<InputRef, V
InputProps>(({ allowClear = true, ...rest }, ref) => (
<Input ref={ref} allowClear={allowClear} {...rest} />
));
UInputBase.displayName = 'U
Input';
VInputBase.displayName = 'V
Input';
/** 复合形态均沿用 antd 同名子组件;Password/TextArea/Search 默认不开 allowClear。 */
export const
UInput = Object.assign(U
InputBase, {
export const
VInput = Object.assign(V
InputBase, {
Password: Input.Password,
TextArea: Input.TextArea,
Search: Input.Search,
});
export default
U
Input;
export default
V
Input;
.kernel/packages/ui/src/components/List/index.tsx
View file @
93727be
import { List } from 'antd';
/** 项目统一列表,透传 antd List。 */
export const
U
List = List;
export const
V
List = List;
export default
U
List;
export default
V
List;
.kernel/packages/ui/src/components/Modal/index.tsx
View file @
93727be
...
...
@@ -3,9 +3,9 @@ import { Modal, type ModalProps } from 'antd';
/**
* 项目统一弹窗。约定默认居中、关闭时销毁内容、确认按钮为主色。
* 取消按钮一律普通按钮(default),不随调用方默认样式漂移;
* 若需 Modal.confirm 等静态方法,后续可在此封装
U
Modal.confirm 包装器。
* 若需 Modal.confirm 等静态方法,后续可在此封装
V
Modal.confirm 包装器。
*/
export function
U
Modal(props: ModalProps) {
export function
V
Modal(props: ModalProps) {
const {
centered = true,
destroyOnClose,
...
...
.kernel/packages/ui/src/components/PageTransition/direction.ts
View file @
93727be
export
type
U
PageTransitionDirection
=
'forward'
|
'back'
;
export
type
V
PageTransitionDirection
=
'forward'
|
'back'
;
/**
* 按路由深浅判断方向:层级变深=进入详情,层级变浅=返回。
* 同级切换(leads → assessment)按 forward 处理,保持一致的轻微右进。
*/
export
function
pageDirection
(
previous
:
string
,
next
:
string
):
U
PageTransitionDirection
{
export
function
pageDirection
(
previous
:
string
,
next
:
string
):
V
PageTransitionDirection
{
const
depth
=
(
path
:
string
)
=>
path
.
split
(
'/'
).
filter
(
Boolean
).
length
;
return
depth
(
next
)
<
depth
(
previous
)
?
'back'
:
'forward'
;
}
.kernel/packages/ui/src/components/PageTransition/index.tsx
View file @
93727be
import type { ReactNode } from 'react';
import type {
U
PageTransitionDirection } from './direction';
import type {
V
PageTransitionDirection } from './direction';
export interface
U
PageTransitionProps {
export interface
V
PageTransitionProps {
/** 页面标识:变化即换掉内容并重新进场(如 users → users/1)。 */
pageKey: string;
/** 进场方向:由列表进入详情为 forward,从详情返回列表为 back。 */
direction?:
U
PageTransitionDirection;
direction?:
V
PageTransitionDirection;
children: ReactNode;
}
...
...
@@ -18,11 +18,11 @@ export interface UPageTransitionProps {
* 放在 @venus/ui 而不是主壳:子应用跑在 wujie 的 shadowRoot 内,主壳样式穿不进去;
* 而 subPath 变化时主壳的 <Outlet> 不重挂载,动效必须在子应用自己的 render 链上。
*/
export function
U
PageTransition({
export function
V
PageTransition({
pageKey,
direction = 'forward',
children,
}:
U
PageTransitionProps) {
}:
V
PageTransitionProps) {
return (
<div key={pageKey} className={`venus-page-transition venus-page-transition--${direction}`}>
{/* 位移放在内层:外层只裁横向,避免 6px 横移临时顶出父容器的横向滚动条。 */}
...
...
.kernel/packages/ui/src/components/Popover/index.tsx
View file @
93727be
import { Popover } from 'antd';
/** 项目统一悬浮卡,透传 antd Popover。可交互内容(按钮、输入)用它,不用 Tooltip。 */
export const
U
Popover = Popover;
export const
V
Popover = Popover;
export default
U
Popover;
export default
V
Popover;
.kernel/packages/ui/src/components/Radio/index.tsx
View file @
93727be
import { Radio, type RadioGroupProps, type RadioProps } from 'antd';
export type
U
RadioProps = RadioProps;
export type
U
RadioGroupProps = RadioGroupProps;
export type
V
RadioProps = RadioProps;
export type
V
RadioGroupProps = RadioGroupProps;
export const
URadio = Object.assign((props: U
RadioProps) => <Radio {...props} />, {
export const
VRadio = Object.assign((props: V
RadioProps) => <Radio {...props} />, {
Group: Radio.Group,
});
.kernel/packages/ui/src/components/Result/index.tsx
View file @
93727be
import { Result } from 'antd';
/** 项目统一结果页,透传 antd Result。 */
export const
U
Result = Result;
export const
V
Result = Result;
export default
U
Result;
export default
V
Result;
.kernel/packages/ui/src/components/Select/index.tsx
View file @
93727be
import { Select, type SelectProps } from 'antd';
export type
U
SelectProps = SelectProps;
export type
V
SelectProps = SelectProps;
/**
* 项目统一下拉选择,默认开启 allowClear。
* 当前不转发 ref 以规避各 antd 大版本 ref 类型差异;如需 ref 再按需补充。
*/
export function
USelect(props: U
SelectProps) {
export function
VSelect(props: V
SelectProps) {
const { allowClear = true, ...rest } = props;
return <Select allowClear={allowClear} {...rest} />;
}
.kernel/packages/ui/src/components/Steps/index.tsx
View file @
93727be
import { Steps, type StepsProps } from 'antd';
export type
U
StepsProps = StepsProps;
export type
V
StepsProps = StepsProps;
/**
* 项目统一步骤条(模板导入的四步流程用)。
* 尺寸与字号由 themeConfig 的 Steps token 下发,这里只作统一命名入口。
*/
export function
USteps(props: U
StepsProps) {
export function
VSteps(props: V
StepsProps) {
return <Steps {...props} />;
}
.kernel/packages/ui/src/components/Switch/index.tsx
View file @
93727be
import { Switch, type SwitchProps } from 'antd';
export type
U
SwitchProps = SwitchProps;
export const
USwitch = (props: U
SwitchProps) => <Switch {...props} />;
export type
V
SwitchProps = SwitchProps;
export const
VSwitch = (props: V
SwitchProps) => <Switch {...props} />;
.kernel/packages/ui/src/components/Table/imageCell.tsx
View file @
93727be
import type { ReactNode } from 'react';
import type { ColumnsType } from 'antd/es/table';
import {
U
Image } from '../Image';
import {
V
Image } from '../Image';
/** 常见图片扩展名:去 query/hash 后按路径结尾判断。 */
const IMAGE_EXT = /\.(jpe?g|png|gif|bmp|webp|svg|avif|ico|tiff?|heic|heif)$/i;
...
...
@@ -34,7 +34,7 @@ const THUMB_HEIGHT = 48;
* 统一渲染成可点击查看大图的 cover 缩略图,消费方无需各自实现。
*
* 判断基于 render 的原始 value 参数,因此可安全叠加在 DataTable 的省略包装
* (withLineLimit)之上:图片列在这里直接返回
U
Image、不会走进 EllipsisText;
* (withLineLimit)之上:图片列在这里直接返回
V
Image、不会走进 EllipsisText;
* 非图片列调用原 render,行为与未包装完全一致。递归处理表头分组 children。
*/
export function withImageCell<T>(columns: ColumnsType<T> | undefined): ColumnsType<T> | undefined {
...
...
@@ -52,7 +52,7 @@ export function withImageCell<T>(columns: ColumnsType<T> | undefined): ColumnsTy
render: (value: unknown, record: T, index: number) => {
if (isImageUrl(value)) {
return (
<
U
Image
<
V
Image
src={value}
width={THUMB_WIDTH}
height={THUMB_HEIGHT}
...
...
.kernel/packages/ui/src/components/Table/index.tsx
View file @
93727be
...
...
@@ -15,7 +15,7 @@ import { withImageCell } from './imageCell';
*
* loading:统一交给 resolveTableLoading 注入品牌指示器,页面仍只传 boolean。
*/
export function
U
Table<T>(props: TableProps<T>) {
export function
V
Table<T>(props: TableProps<T>) {
const { size = 'middle', rootClassName, loading, ...rest } = props;
const remeasureEpoch = useScrollbarRemeasure(true);
return (
...
...
@@ -26,7 +26,7 @@ export function UTable<T>(props: TableProps<T>) {
loading={resolveTableLoading(loading)}
{...rest}
// 图片单元格能力收口在表格底层:原始值是图片链接的列自动渲染成可点大图的
// cover 缩略图,所有消费方(含裸用
U
Table 的页面)无需各自实现。
// cover 缩略图,所有消费方(含裸用
V
Table 的页面)无需各自实现。
columns={withImageCell(rest.columns)}
/>
);
...
...
.kernel/packages/ui/src/components/Table/loading.tsx
View file @
93727be
...
...
@@ -6,7 +6,7 @@ import { TableLoader } from '../TableLoader';
*
* antd Table 的 loading 支持 boolean | SpinProps,页面一直只传 boolean(19 个列表页
* 全是 `loading={query.isPending || query.isFetching}`),于是转圈图标由 antd 默认下发。
*
U
Table / FillTable 在这里把 boolean 规范化成带品牌 indicator 的 SpinProps,
*
V
Table / FillTable 在这里把 boolean 规范化成带品牌 indicator 的 SpinProps,
* 页面一行都不用改;已经传对象且自带 indicator / spinning 的调用方保持原样。
*
* 只作用于表格:按钮 loading 走 antd Button 自己的图标,抽屉/卡片里的 Spin 不受影响。
...
...
.kernel/packages/ui/src/components/TableLoader/index.tsx
View file @
93727be
...
...
@@ -10,7 +10,7 @@ import type { CSSProperties } from 'react';
* - 3 行左侧的青绿节点沿用 venus-brand-node 的 1.8s 错峰呼吸(0 / 0.3 / 0.6s),
* 行占位条另用 2.2s 提亮,两个周期互质,避免整枚图机械同步摆动。
*
* 由
U
Table / FillTable 的 resolveTableLoading 统一注入 antd Spin 的 indicator,
* 由
V
Table / FillTable 的 resolveTableLoading 统一注入 antd Spin 的 indicator,
* 页面只传 boolean,不需要知道这个组件存在。动效与色值全部由 ui.css 下发。
* 组件无状态、无随机数、无定时器,纯 SVG + CSS,尊重 prefers-reduced-motion。
*/
...
...
.kernel/packages/ui/src/components/Tabs/index.tsx
View file @
93727be
/* eslint-disable react-refresh/only-export-components -- tabLabel 是与
UTabs 配套的无状态渲染函数,拆出组件目录会破坏 U
* 单一出口约定 */
/* eslint-disable react-refresh/only-export-components -- tabLabel 是与
VTabs 配套的无状态渲染函数,拆出组件目录会破坏 V
* 单一出口约定 */
import type { ElementRef, ReactNode } from 'react';
import { forwardRef } from 'react';
import { Tabs } from 'antd';
import type { TabsProps } from 'antd';
export type
U
TabsSize = 'md' | 'lg';
export type
V
TabsSize = 'md' | 'lg';
// antd Tabs 自带 size(SizeType),语义是控件尺寸,与我们「页面级 / 抽屉放大版」不同,
// 这里剔除后自定义 size,避免两套 size 含义打架。
export interface
U
TabsProps extends Omit<TabsProps, 'size'> {
export interface
V
TabsProps extends Omit<TabsProps, 'size'> {
/** 尺寸:md 页面级(默认,14px);lg 抽屉/详情内的放大版(16px)。 */
size?:
U
TabsSize;
size?:
V
TabsSize;
}
/**
...
...
@@ -21,16 +21,16 @@ export interface UTabsProps extends Omit<TabsProps, 'size'> {
*
* 计角标请用配套 tabLabel(),替代各页面手搓的 venus-num / approval-detail-tab-count。
*/
export const
UTabs = forwardRef<ElementRef<typeof Tabs>, U
TabsProps>(
export const
VTabs = forwardRef<ElementRef<typeof Tabs>, V
TabsProps>(
({ className, size = 'md', ...rest }, ref) => {
const base = size === 'lg' ? 'venus-page__tabs venus-page__tabs--lg' : 'venus-page__tabs';
return <Tabs ref={ref} {...rest} className={className ? `${base} ${className}` : base} />;
},
);
UTabs.displayName = 'U
Tabs';
VTabs.displayName = 'V
Tabs';
export default
U
Tabs;
export default
V
Tabs;
export interface TabLabelOptions {
/** 角标数字/文案;传 null / undefined / '' 则不渲染角标。 */
...
...
.kernel/packages/ui/src/components/Tag/index.tsx
View file @
93727be
import { Tag, type TagProps } from 'antd';
import type { ReactNode } from 'react';
export type
U
TagProps = TagProps;
export type
V
TagProps = TagProps;
/**
* 把状态标签里的文字圆点「● 启用」收成 CSS 圆点(见 ui.css 的 .venus-tag--dot)。
...
...
@@ -25,7 +25,7 @@ function splitDot(children: ReactNode): ReactNode | null {
* 柔和填充 + 4px 圆角既分得清层级,又不抢正文。需要强分隔时显式传 bordered。
* 传「● 状态」时圆点自动改由 CSS 绘制,基线不随字体漂移。
*/
export function
UTag({ bordered = false, className, children, ...rest }: U
TagProps) {
export function
VTag({ bordered = false, className, children, ...rest }: V
TagProps) {
const dotless = splitDot(children);
const hasDot = dotless !== null;
return (
...
...
.kernel/packages/ui/src/components/Timeline/index.tsx
View file @
93727be
import { Timeline, type TimelineProps } from 'antd';
export type
U
TimelineProps = TimelineProps;
export type
V
TimelineProps = TimelineProps;
/**
* 项目统一时间轴(提现审批流转用)。
* 圆点配色取 themeConfig 的语义色,不在页面里为「已完成 / 当前」各写一个 hex。
*/
export function
UTimeline(props: U
TimelineProps) {
export function
VTimeline(props: V
TimelineProps) {
return <Timeline {...props} />;
}
.kernel/packages/ui/src/components/Tooltip/index.tsx
View file @
93727be
import { Tooltip } from 'antd';
/** 项目统一文字提示,透传 antd Tooltip。 */
export const
U
Tooltip = Tooltip;
export const
V
Tooltip = Tooltip;
export default
U
Tooltip;
export default
V
Tooltip;
.kernel/packages/ui/src/components/Typography/index.tsx
View file @
93727be
import { Typography } from 'antd';
/** 项目统一排版组件,透传 antd Typography 全部能力与子组件。 */
export const
U
Typography = Object.assign(Typography, {
export const
V
Typography = Object.assign(Typography, {
Title: Typography.Title,
Text: Typography.Text,
Paragraph: Typography.Paragraph,
Link: Typography.Link,
});
export const
U
Title = Typography.Title;
export const
U
Text = Typography.Text;
export const
U
Paragraph = Typography.Paragraph;
export const
V
Title = Typography.Title;
export const
V
Text = Typography.Text;
export const
V
Paragraph = Typography.Paragraph;
export default
U
Typography;
export default
V
Typography;
.kernel/packages/ui/src/components/Upload/index.tsx
View file @
93727be
import { Upload } from 'antd';
/** 项目上传。统一命名入口,
U
Upload.Dragger 可直接使用。 */
export const
U
Upload = Upload;
/** 项目上传。统一命名入口,
V
Upload.Dragger 可直接使用。 */
export const
V
Upload = Upload;
.kernel/packages/ui/src/index.ts
View file @
93727be
// @venus/ui —— VENUS 应用基座自定义组件库(基于 antd,前缀
U
*)
// @venus/ui —— VENUS 应用基座自定义组件库(基于 antd,前缀
V
*)
// 模块化管理:每个组件一个文件夹,位于 ./components/<Name>/index.tsx,
// 本文件为统一导出口,外部消费方式不变:
// import {
UButton, U
Table } from '@venus/ui';
// import {
VButton, V
Table } from '@venus/ui';
//
// 子应用禁止从 antd 直引组件(eslint no-restricted-imports 门禁)。
// 缺什么就在这里补一个
U
*,再去页面里消费 —— 不要在页面里绕过去。
// 缺什么就在这里补一个
V
*,再去页面里消费 —— 不要在页面里绕过去。
// 样式层:精致度与布局的公共规则。CSS 会随各应用打包进自己的 style-*.css,
// 在 wujie 的 shadowRoot 内生效;主壳文档样式表穿不进 shadow DOM,别把规则写回 shell。
...
...
@@ -16,74 +16,74 @@ import './styles/injectThinScrollbar';
import
'./styles/ui.css'
;
import
'./styles/feedback.css'
;
export
{
U
App
}
from
'./components/App'
;
export
type
{
U
AppProps
}
from
'./components/App'
;
export
{
use
UApp
,
useU
Message
}
from
'./components/App/hooks'
;
export
{
V
App
}
from
'./components/App'
;
export
type
{
V
AppProps
}
from
'./components/App'
;
export
{
use
VApp
,
useV
Message
}
from
'./components/App/hooks'
;
export
{
installGlobalUnhandledRejectionHandler
}
from
'./components/App/globalError'
;
export
{
U
Button
}
from
'./components/Button'
;
export
type
{
U
ButtonProps
}
from
'./components/Button'
;
export
{
V
Button
}
from
'./components/Button'
;
export
type
{
V
ButtonProps
}
from
'./components/Button'
;
// 表格工具栏「导出」动作的统一图标。DataTable 检测 tone='export' 自动前置,
// 各列表页不再各自 import 图标,保证全站导出按钮外观一致。
export
{
DownloadOutlined
as
U
ExportIcon
}
from
'@ant-design/icons'
;
export
{
DownloadOutlined
as
V
ExportIcon
}
from
'@ant-design/icons'
;
export
{
U
Input
}
from
'./components/Input'
;
export
type
{
U
InputProps
}
from
'./components/Input'
;
export
{
V
Input
}
from
'./components/Input'
;
export
type
{
V
InputProps
}
from
'./components/Input'
;
export
{
U
Select
}
from
'./components/Select'
;
export
type
{
U
SelectProps
}
from
'./components/Select'
;
export
{
V
Select
}
from
'./components/Select'
;
export
type
{
V
SelectProps
}
from
'./components/Select'
;
export
{
U
Cascader
}
from
'./components/Cascader'
;
export
type
{
U
CascaderProps
}
from
'./components/Cascader'
;
export
{
V
Cascader
}
from
'./components/Cascader'
;
export
type
{
V
CascaderProps
}
from
'./components/Cascader'
;
export
{
UForm
,
U
FormItem
}
from
'./components/Form'
;
export
{
VForm
,
V
FormItem
}
from
'./components/Form'
;
export
{
UTypography
,
UTitle
,
UText
,
U
Paragraph
}
from
'./components/Typography'
;
export
{
VTypography
,
VTitle
,
VText
,
V
Paragraph
}
from
'./components/Typography'
;
export
{
U
Card
}
from
'./components/Card'
;
export
type
{
U
CardProps
}
from
'./components/Card'
;
export
{
U
Tag
}
from
'./components/Tag'
;
export
type
{
U
TagProps
}
from
'./components/Tag'
;
export
{
U
Image
}
from
'./components/Image'
;
export
type
{
U
ImageProps
}
from
'./components/Image'
;
export
{
U
Alert
}
from
'./components/Alert'
;
export
type
{
U
AlertProps
}
from
'./components/Alert'
;
export
{
U
Modal
}
from
'./components/Modal'
;
export
{
U
Drawer
}
from
'./components/Drawer'
;
export
type
{
U
DrawerProps
}
from
'./components/Drawer'
;
export
{
U
Table
}
from
'./components/Table'
;
export
{
V
Card
}
from
'./components/Card'
;
export
type
{
V
CardProps
}
from
'./components/Card'
;
export
{
V
Tag
}
from
'./components/Tag'
;
export
type
{
V
TagProps
}
from
'./components/Tag'
;
export
{
V
Image
}
from
'./components/Image'
;
export
type
{
V
ImageProps
}
from
'./components/Image'
;
export
{
V
Alert
}
from
'./components/Alert'
;
export
type
{
V
AlertProps
}
from
'./components/Alert'
;
export
{
V
Modal
}
from
'./components/Modal'
;
export
{
V
Drawer
}
from
'./components/Drawer'
;
export
type
{
V
DrawerProps
}
from
'./components/Drawer'
;
export
{
V
Table
}
from
'./components/Table'
;
export
{
FillTable
}
from
'./components/FillTable'
;
export
{
TableLoader
}
from
'./components/TableLoader'
;
export
type
{
TableLoaderProps
}
from
'./components/TableLoader'
;
export
{
U
Upload
}
from
'./components/Upload'
;
export
{
V
Upload
}
from
'./components/Upload'
;
export
{
Skeleton
}
from
'./components/Skeleton'
;
export
type
{
SkeletonVariant
}
from
'./components/Skeleton'
;
export
{
U
Tabs
,
tabLabel
}
from
'./components/Tabs'
;
export
type
{
UTabsProps
,
U
TabsSize
,
TabLabelOptions
}
from
'./components/Tabs'
;
export
{
U
Checkbox
}
from
'./components/Checkbox'
;
export
{
U
List
}
from
'./components/List'
;
export
{
U
Tooltip
}
from
'./components/Tooltip'
;
export
{
U
Popover
}
from
'./components/Popover'
;
export
{
U
Result
}
from
'./components/Result'
;
export
{
U
Empty
}
from
'./components/Empty'
;
export
type
{
U
EmptyProps
}
from
'./components/Empty'
;
export
{
U
PageTransition
}
from
'./components/PageTransition'
;
export
type
{
U
PageTransitionProps
}
from
'./components/PageTransition'
;
export
{
V
Tabs
,
tabLabel
}
from
'./components/Tabs'
;
export
type
{
VTabsProps
,
V
TabsSize
,
TabLabelOptions
}
from
'./components/Tabs'
;
export
{
V
Checkbox
}
from
'./components/Checkbox'
;
export
{
V
List
}
from
'./components/List'
;
export
{
V
Tooltip
}
from
'./components/Tooltip'
;
export
{
V
Popover
}
from
'./components/Popover'
;
export
{
V
Result
}
from
'./components/Result'
;
export
{
V
Empty
}
from
'./components/Empty'
;
export
type
{
V
EmptyProps
}
from
'./components/Empty'
;
export
{
V
PageTransition
}
from
'./components/PageTransition'
;
export
type
{
V
PageTransitionProps
}
from
'./components/PageTransition'
;
export
{
pageDirection
}
from
'./components/PageTransition/direction'
;
export
type
{
U
PageTransitionDirection
}
from
'./components/PageTransition/direction'
;
export
{
U
Steps
}
from
'./components/Steps'
;
export
type
{
U
StepsProps
}
from
'./components/Steps'
;
export
{
U
Timeline
}
from
'./components/Timeline'
;
export
type
{
U
TimelineProps
}
from
'./components/Timeline'
;
export
{
U
Dropdown
}
from
'./components/Dropdown'
;
export
type
{
U
DropdownProps
}
from
'./components/Dropdown'
;
export
type
{
V
PageTransitionDirection
}
from
'./components/PageTransition/direction'
;
export
{
V
Steps
}
from
'./components/Steps'
;
export
type
{
V
StepsProps
}
from
'./components/Steps'
;
export
{
V
Timeline
}
from
'./components/Timeline'
;
export
type
{
V
TimelineProps
}
from
'./components/Timeline'
;
export
{
V
Dropdown
}
from
'./components/Dropdown'
;
export
type
{
V
DropdownProps
}
from
'./components/Dropdown'
;
export
{
U
DatePicker
}
from
'./components/DatePicker'
;
export
type
{
U
DatePickerProps
}
from
'./components/DatePicker'
;
export
{
U
Radio
}
from
'./components/Radio'
;
export
type
{
URadioProps
,
U
RadioGroupProps
}
from
'./components/Radio'
;
export
{
U
Switch
}
from
'./components/Switch'
;
export
type
{
U
SwitchProps
}
from
'./components/Switch'
;
export
{
U
Descriptions
}
from
'./components/Descriptions'
;
export
type
{
U
DescriptionsProps
}
from
'./components/Descriptions'
;
export
{
V
DatePicker
}
from
'./components/DatePicker'
;
export
type
{
V
DatePickerProps
}
from
'./components/DatePicker'
;
export
{
V
Radio
}
from
'./components/Radio'
;
export
type
{
VRadioProps
,
V
RadioGroupProps
}
from
'./components/Radio'
;
export
{
V
Switch
}
from
'./components/Switch'
;
export
type
{
V
SwitchProps
}
from
'./components/Switch'
;
export
{
V
Descriptions
}
from
'./components/Descriptions'
;
export
type
{
V
DescriptionsProps
}
from
'./components/Descriptions'
;
README.md
View file @
93727be
...
...
@@ -292,7 +292,7 @@ pnpm release:preview # 本地预览 dist/(行为对
api-core/ 请求签名框架(web-host / ROP / GSC 策略)
download-center/ 系统级下载网关(引擎 / 状态机 / 落地)
design-tokens/ 主题令牌(palette.ts + tokens.css 双真源)
ui/ biz/
U
* 组件库 / 通用业务组件层
ui/ biz/
V
* 组件库 / 通用业务组件层
vite-config/ alias 单一真源 + shell/子应用两套 Vite 工厂
typescript-config/ eslint-config/
scripts/ dev / 边界闸门 / 令牌对账 / 结构对账 / release/ 发布引擎(全量·增量·回滚·自检)
...
...
apps/example/src/App.tsx
View file @
93727be
...
...
@@ -4,7 +4,7 @@ import { SubAppProvider, readInitialPage, shortName, subappBus } from '@venus/pl
import RoleManage from './pages/RoleManage';
import AccountManage from './pages/AccountManage';
import {
UEmpty, U
PageTransition } from '@venus/ui';
import {
VEmpty, V
PageTransition } from '@venus/ui';
/**
* 页名 -> 页面组件。
* 页名来自后端菜单 route 的末段:/system/role -> role、/system/user -> user。
...
...
@@ -19,7 +19,7 @@ const PAGES = {
function renderPage(page: string) {
const Page = PAGES[page as keyof typeof PAGES];
return Page ? <Page /> : <
U
Empty description={`没有名为「${page}」的页面`} />;
return Page ? <Page /> : <
V
Empty description={`没有名为「${page}」的页面`} />;
}
function SystemApp() {
...
...
@@ -51,7 +51,7 @@ function SystemApp() {
};
}, []);
return <
UPageTransition pageKey={page}>{renderPage(page)}</U
PageTransition>;
return <
VPageTransition pageKey={page}>{renderPage(page)}</V
PageTransition>;
}
export function App() {
...
...
apps/example/src/pages/AccountManage/components/AccountFormDrawer.tsx
View file @
93727be
import { useEffect } from 'react';
import { useMutation } from '@tanstack/react-query';
import {
UButton, UDrawer, UForm, useU
Message } from '@venus/ui';
import {
VButton, VDrawer, VForm, useV
Message } from '@venus/ui';
import { user, type OrgNode, type RoleOption, type UserPageItem } from '@/api';
import { CombiForm, type FieldSchema } from '@/components';
import { dataScopeOptions } from '@/constants/dataScope';
...
...
@@ -33,9 +33,9 @@ export function AccountFormDrawer({
onClose,
onSuccess,
}: AccountFormDrawerProps) {
const message = use
U
Message();
const [form] =
U
Form.useForm<AccountFormValues>();
const selectedRoleIds =
U
Form.useWatch('roleIds', form) ?? [];
const message = use
V
Message();
const [form] =
V
Form.useForm<AccountFormValues>();
const selectedRoleIds =
V
Form.useWatch('roleIds', form) ?? [];
const isEdit = Boolean(account);
const saveMutation = useMutation({
mutationFn: (values: AccountFormValues) => {
...
...
@@ -150,17 +150,17 @@ export function AccountFormDrawer({
];
return (
<
U
Drawer
<
V
Drawer
open={open}
title={isEdit ? '编辑账号' : '新增账号'}
size={560}
onClose={onClose}
footer={
<div style={footerStyle}>
<
UButton type="default" onClick={onClose}>取消</U
Button>
<
U
Button type="primary" loading={saveMutation.isPending} onClick={() => form.submit()}>
<
VButton type="default" onClick={onClose}>取消</V
Button>
<
V
Button type="primary" loading={saveMutation.isPending} onClick={() => form.submit()}>
保存
</
U
Button>
</
V
Button>
</div>
}
>
...
...
@@ -178,7 +178,7 @@ export function AccountFormDrawer({
return (
<div style={roleListStyle}>
{roleOptions.map((item) => (
<
U
Button
<
V
Button
key={item.roleId}
type={selectedRoleIds.includes(item.roleId) ? 'primary' : 'default'}
style={roleOptionStyle}
...
...
@@ -190,14 +190,14 @@ export function AccountFormDrawer({
}}
>
{item.roleName}
</
U
Button>
</
V
Button>
))}
</div>
);
return undefined;
}}
/>
</
U
Drawer>
</
V
Drawer>
);
}
...
...
apps/example/src/pages/AccountManage/index.tsx
View file @
93727be
import { useMemo, useState } from 'react';
import { useMutation, useQuery } from '@tanstack/react-query';
import {
UCard, UTag, UText, useU
Message } from '@venus/ui';
import {
VCard, VTag, VText, useV
Message } from '@venus/ui';
import {
DataTable,
DEFAULT_PAGE_SIZE,
...
...
@@ -40,7 +40,7 @@ function toParams(values: Record<string, unknown>, pagination: SearchPagination)
}
export default function AccountManage() {
const message = use
U
Message();
const message = use
V
Message();
const [params, setParams] = useState<UserPageParams>({ current: 1, size: DEFAULT_PAGE_SIZE });
const [queryVersion, setQueryVersion] = useState(0);
const [accountFormOpen, setAccountFormOpen] = useState(false);
...
...
@@ -132,9 +132,9 @@ export default function AccountManage() {
width: 160,
line: 1,
render: (value) => (
<
U
Text>
<
V
Text>
<code className="venus-code">{value}</code>
</
U
Text>
</
V
Text>
),
},
{ title: '姓名', dataIndex: 'name', width: 130, line: 1 },
...
...
@@ -148,9 +148,9 @@ export default function AccountManage() {
names.length ? (
<span className="venus-tag-list">
{names.map((name) => (
<
U
Tag key={name} color="blue">
<
V
Tag key={name} color="blue">
{name}
</
U
Tag>
</
V
Tag>
))}
</span>
) : (
...
...
@@ -162,9 +162,9 @@ export default function AccountManage() {
title: '状态',
width: 90,
render: (_, row) => (
<
U
Tag color={row.status === 1 ? 'green' : 'default'}>
<
V
Tag color={row.status === 1 ? 'green' : 'default'}>
{row.status === 1 ? '启用' : '停用'}
</
U
Tag>
</
V
Tag>
),
},
{ title: '最后登录', dataIndex: 'lastLoginAt', width: 170 },
...
...
@@ -207,7 +207,7 @@ export default function AccountManage() {
</PermButton>
}
>
<
U
Card className="venus-filter-card" size="small">
<
V
Card className="venus-filter-card" size="small">
<SearchForm
fields={fields}
initialValues={{ orgId: [''], roleId: '', status: '' }}
...
...
@@ -220,8 +220,8 @@ export default function AccountManage() {
setQueryVersion((version) => version + 1);
}}
/>
</
U
Card>
<
U
Card size="small" fill>
</
V
Card>
<
V
Card size="small" fill>
<DataTable<AccountRow>
rowKey="id"
fillHeight
...
...
@@ -240,7 +240,7 @@ export default function AccountManage() {
},
}}
/>
</
U
Card>
</
V
Card>
<AccountFormDrawer
open={accountFormOpen}
account={editingAccount}
...
...
apps/example/src/pages/RoleManage/components/RoleDetailDrawer.tsx
View file @
93727be
import { useMemo, useState } from 'react';
import { CheckOutlined, DownOutlined, MinusOutlined, RightOutlined } from '@ant-design/icons';
import { useQuery } from '@tanstack/react-query';
import {
UAlert, UButton, UDescriptions, UDrawer, U
Text } from '@venus/ui';
import {
VAlert, VButton, VDescriptions, VDrawer, V
Text } from '@venus/ui';
import { menu, role, type MenuNode } from '@/api';
import { getDataScopeLabel } from '@/constants/dataScope';
...
...
@@ -29,19 +29,19 @@ export function RoleDetailDrawer({ open, roleId, onClose }: RoleDetailDrawerProp
const detail = detailQuery.data;
return (
<
U
Drawer
<
V
Drawer
open={open}
placement="right"
size={760}
title={detail ? `角色详情 · ${detail.roleName}` : '角色详情'}
onClose={onClose}
footer={
<
U
Button type="default" style={{ float: 'right' }} onClick={onClose}>
<
V
Button type="default" style={{ float: 'right' }} onClick={onClose}>
关闭
</
U
Button>
</
V
Button>
}
>
{error ? <
U
Alert type="error" showIcon message="角色详情加载失败,请关闭后重试" /> : null}
{error ? <
V
Alert type="error" showIcon message="角色详情加载失败,请关闭后重试" /> : null}
{detail ? (
<>
<div style={summaryStyle}>
...
...
@@ -58,7 +58,7 @@ export function RoleDetailDrawer({ open, roleId, onClose }: RoleDetailDrawerProp
<span>类型 {detail.isBuiltin === 1 ? '内置' : '自定义'}</span>
</div>
<SectionTitle>角色基本信息</SectionTitle>
<
U
Descriptions
<
V
Descriptions
size="small"
column={1}
items={[
...
...
@@ -76,7 +76,7 @@ export function RoleDetailDrawer({ open, roleId, onClose }: RoleDetailDrawerProp
/>
<SectionTitle>菜单可见范围(权限矩阵)</SectionTitle>
<div style={matrixStyle}>
{isLoading ? <
UText type="secondary">权限加载中…</U
Text> : null}
{isLoading ? <
VText type="secondary">权限加载中…</V
Text> : null}
{!isLoading ? (
<PermissionTree
nodes={menuQuery.data ?? []}
...
...
@@ -100,7 +100,7 @@ export function RoleDetailDrawer({ open, roleId, onClose }: RoleDetailDrawerProp
</div>
</>
) : null}
</
U
Drawer>
</
V
Drawer>
);
}
...
...
@@ -199,7 +199,7 @@ function PermissionTreeNode({
>
<div style={{ ...treeLabelStyle, paddingLeft: depth * 22 }}>
{hasChildren ? (
<
U
Button
<
V
Button
type="text"
size="small"
aria-label={`${expanded ? '收起' : '展开'}${node.label}`}
...
...
@@ -211,7 +211,7 @@ function PermissionTreeNode({
<span style={treeBranchStyle}>•</span>
)}
<PermissionMark state={nodePermissionState(node, grantedIds)} />
<
UText strong={node.nodeType === 1}>{node.label}</U
Text>
<
VText strong={node.nodeType === 1}>{node.label}</V
Text>
</div>
{expanded && buttons.length ? (
<div style={{ ...buttonListStyle, marginLeft: (depth + 1) * 22 + 18 }} role="group">
...
...
apps/example/src/pages/RoleManage/components/RoleFormDrawer.tsx
View file @
93727be
import { useEffect } from 'react';
import { useMutation } from '@tanstack/react-query';
import {
UButton, UDrawer, UForm, useU
Message } from '@venus/ui';
import {
VButton, VDrawer, VForm, useV
Message } from '@venus/ui';
import { role, type RolePageItem } from '@/api';
import { CombiForm, type FieldSchema } from '@/components';
import { dataScopeOptions } from '@/constants/dataScope';
...
...
@@ -27,8 +27,8 @@ const statusOptions = [
];
export function RoleFormDrawer({ open, roleItem, onClose, onSuccess }: RoleFormDrawerProps) {
const message = use
U
Message();
const [form] =
U
Form.useForm<RoleFormValues>();
const message = use
V
Message();
const [form] =
V
Form.useForm<RoleFormValues>();
const isEdit = Boolean(roleItem);
const saveMutation = useMutation({
mutationFn: (values: RoleFormValues) => {
...
...
@@ -125,17 +125,17 @@ export function RoleFormDrawer({ open, roleItem, onClose, onSuccess }: RoleFormD
];
return (
<
U
Drawer
<
V
Drawer
open={open}
title={isEdit ? '编辑角色' : '新增角色'}
size={560}
onClose={onClose}
footer={
<div style={footerStyle}>
<
UButton type="default" onClick={onClose}>取消</U
Button>
<
U
Button type="primary" loading={saveMutation.isPending} onClick={() => form.submit()}>
<
VButton type="default" onClick={onClose}>取消</V
Button>
<
V
Button type="primary" loading={saveMutation.isPending} onClick={() => form.submit()}>
保存
</
U
Button>
</
V
Button>
</div>
}
>
...
...
@@ -149,7 +149,7 @@ export function RoleFormDrawer({ open, roleItem, onClose, onSuccess }: RoleFormD
sectionContentStyle={twoColumnStyle}
renderSectionTitle={(title) => <SectionTitle>{title}</SectionTitle>}
/>
</
U
Drawer>
</
V
Drawer>
);
}
...
...
apps/example/src/pages/RoleManage/index.tsx
View file @
93727be
import { useMemo, useState } from 'react';
import { useMutation, useQuery } from '@tanstack/react-query';
import {
UCard, UTag, UText, useU
Message } from '@venus/ui';
import {
VCard, VTag, VText, useV
Message } from '@venus/ui';
import {
DataTable,
DEFAULT_PAGE_SIZE,
...
...
@@ -43,7 +43,7 @@ function createRolePageParams(
}
export default function RoleManage() {
const message = use
U
Message();
const message = use
V
Message();
const [params, setParams] = useState<RolePageParams>({
current: 1,
size: DEFAULT_PAGE_SIZE,
...
...
@@ -111,9 +111,9 @@ export default function RoleManage() {
width: 220,
line: 1,
render: (v) => (
<
U
Text>
<
V
Text>
<code className="venus-code">{v}</code>
</
U
Text>
</
V
Text>
),
},
{ title: '账号数', dataIndex: 'userCount' },
...
...
@@ -121,14 +121,14 @@ export default function RoleManage() {
{
title: '类型',
dataIndex: 'type',
render: (v) => <
UTag color={v === '内置' ? 'geekblue' : 'default'}>{v}</U
Tag>,
render: (v) => <
VTag color={v === '内置' ? 'geekblue' : 'default'}>{v}</V
Tag>,
},
{
title: '状态',
render: (_, r) => (
<
U
Tag color={r.status === 1 ? 'green' : 'default'}>
<
V
Tag color={r.status === 1 ? 'green' : 'default'}>
● {r.status === 1 ? '启用' : '停用'}
</
U
Tag>
</
V
Tag>
),
},
];
...
...
@@ -170,7 +170,7 @@ export default function RoleManage() {
</PermButton>
}
>
<
U
Card className="venus-filter-card" size="small">
<
V
Card className="venus-filter-card" size="small">
<SearchForm
fields={fields}
initialValues={{ type: '', status: '' }}
...
...
@@ -183,8 +183,8 @@ export default function RoleManage() {
setQueryVersion((version) => version + 1);
}}
/>
</
U
Card>
<
U
Card size="small" fill>
</
V
Card>
<
V
Card size="small" fill>
<DataTable<Row>
rowKey="id"
fillHeight
...
...
@@ -204,7 +204,7 @@ export default function RoleManage() {
},
}}
/>
</
U
Card>
</
V
Card>
<RoleFormDrawer
open={roleFormOpen}
roleItem={editingRole}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment