ci: Prettier纳入两层防御体系 (#520)
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 1m6s
CI Build & Deploy Pipeline / Build Staging Web Image (push) Successful in 1m49s
CI Build & Deploy Pipeline / Build Production API Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (push) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (push) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 3m1s
CI/CD Pipeline / Unit Tests (push) Successful in 3m20s
CI/CD Pipeline / Integration Tests (push) Successful in 1m29s
CI Build & Deploy Pipeline / Build Staging API Image (push) Successful in 7m4s
CI Build & Deploy Pipeline / Build Staging Worker Image (push) Successful in 7m54s
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 45s
CI Build & Deploy Pipeline / Staging E2E Tests (push) Failing after 2m50s
CI Build & Deploy Pipeline / Staging API Integration Tests (push) Successful in 3m28s

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #520.
This commit is contained in:
2026-07-18 18:08:19 +08:00
committed by auto-approve-bot
parent 1ee779a566
commit 0fcb77b991
145 changed files with 10310 additions and 12869 deletions
+25 -27
View File
@@ -2,26 +2,25 @@
* V21 Button 按钮
* 封装 Ant Design Button,应用 V21 设计系统样式
*/
import React from "react";
import { Button as AntButton } from "antd";
import type { ButtonProps as AntButtonProps } from "antd";
import classNames from "classnames";
import "./ui.css";
import React from "react"
import { Button as AntButton } from "antd"
import type { ButtonProps as AntButtonProps } from "antd"
import classNames from "classnames"
import "./ui.css"
export type ButtonType =
"primary" | "secondary" | "ghost" | "text" | "danger" | "link";
export type ButtonType = "primary" | "secondary" | "ghost" | "text" | "danger" | "link"
export type ButtonSize = "sm" | "md" | "lg";
export type ButtonSize = "sm" | "md" | "lg"
export interface ButtonProps extends Omit<AntButtonProps, "type" | "size"> {
/** 按钮类型 */
buttonType?: ButtonType;
buttonType?: ButtonType
/** 按钮尺寸 */
buttonSize?: ButtonSize;
buttonSize?: ButtonSize
/** 兼容 antd type(用于直接替换) */
type?: AntButtonProps["type"];
type?: AntButtonProps["type"]
/** 兼容 antd size */
size?: AntButtonProps["size"];
size?: AntButtonProps["size"]
}
const TYPE_CLASS_MAP: Record<ButtonType, string> = {
@@ -31,29 +30,29 @@ const TYPE_CLASS_MAP: Record<ButtonType, string> = {
text: "xx-btn-text",
danger: "xx-btn-danger",
link: "xx-btn-link",
};
}
const SIZE_CLASS_MAP: Record<ButtonSize, string> = {
sm: "xx-btn-sm",
md: "xx-btn-md",
lg: "xx-btn-lg",
};
}
/** 将 buttonType 映射到 antd type */
const toAntdType = (bt: ButtonType): AntButtonProps["type"] => {
switch (bt) {
case "primary":
return "primary";
return "primary"
case "danger":
return "primary";
return "primary"
case "link":
return "link";
return "link"
case "text":
return "text";
return "text"
default:
return "default";
return "default"
}
};
}
const Button: React.FC<ButtonProps> = ({
buttonType = "ghost",
@@ -64,17 +63,16 @@ const Button: React.FC<ButtonProps> = ({
size,
...rest
}) => {
const antdType = type ?? toAntdType(buttonType);
const antdType = type ?? toAntdType(buttonType)
const antdSize =
size ??
(buttonSize === "sm" ? "small" : buttonSize === "lg" ? "large" : "middle");
size ?? (buttonSize === "sm" ? "small" : buttonSize === "lg" ? "large" : "middle")
const v21Class = classNames(
"xx-btn",
TYPE_CLASS_MAP[buttonType],
SIZE_CLASS_MAP[buttonSize],
className,
);
)
return (
<AntButton
@@ -86,7 +84,7 @@ const Button: React.FC<ButtonProps> = ({
>
{children}
</AntButton>
);
};
)
}
export default Button;
export default Button
+10 -14
View File
@@ -2,24 +2,20 @@
* V21 Card 卡片
* 封装 Ant Design Card,应用 V21 设计系统样式
*/
import React from "react";
import { Card as AntCard } from "antd";
import type { CardProps as AntCardProps } from "antd";
import classNames from "classnames";
import "./ui.css";
import React from "react"
import { Card as AntCard } from "antd"
import type { CardProps as AntCardProps } from "antd"
import classNames from "classnames"
import "./ui.css"
export interface CardProps extends AntCardProps {
/** 是否启用悬浮效果 */
hover?: boolean;
hover?: boolean
}
const Card: React.FC<CardProps> = ({ className, hover, ...rest }) => {
const v21Class = classNames(
"xx-card-v21",
hover && "xx-card-hover",
className,
);
return <AntCard className={v21Class} {...rest} />;
};
const v21Class = classNames("xx-card-v21", hover && "xx-card-hover", className)
return <AntCard className={v21Class} {...rest} />
}
export default Card;
export default Card
+34 -45
View File
@@ -3,70 +3,59 @@
* 封装 Ant Design Input,应用 V21 设计系统样式
*/
/* eslint-disable react-refresh/only-export-components */
import React from "react";
import { Input as AntInput } from "antd";
import type { InputProps as AntInputProps } from "antd";
import type { InputRef } from "antd/es/input";
import classNames from "classnames";
import "./ui.css";
import React from "react"
import { Input as AntInput } from "antd"
import type { InputProps as AntInputProps } from "antd"
import type { InputRef } from "antd/es/input"
import classNames from "classnames"
import "./ui.css"
const {
Search: AntSearch,
TextArea: AntTextArea,
Password: AntPassword,
} = AntInput;
const { Search: AntSearch, TextArea: AntTextArea, Password: AntPassword } = AntInput
export interface InputProps extends AntInputProps {
/** 是否处于错误状态 */
error?: boolean;
error?: boolean
}
/** 基础 Input */
const Input = React.forwardRef<InputRef, InputProps>(
({ className, error, ...rest }, ref) => {
const v21Class = classNames(
"xx-input",
error && "xx-input-error",
className,
);
return <AntInput ref={ref} className={v21Class} {...rest} />;
},
);
Input.displayName = "Input";
const Input = React.forwardRef<InputRef, InputProps>(({ className, error, ...rest }, ref) => {
const v21Class = classNames("xx-input", error && "xx-input-error", className)
return <AntInput ref={ref} className={v21Class} {...rest} />
})
Input.displayName = "Input"
/** Search 搜索框 */
const Search: React.FC<
React.ComponentProps<typeof AntSearch> & { error?: boolean }
> = ({ className, error, ...rest }) => {
const v21Class = classNames(
"xx-input",
"xx-input-search",
error && "xx-input-error",
className,
);
return <AntSearch className={v21Class} {...rest} />;
};
const Search: React.FC<React.ComponentProps<typeof AntSearch> & { error?: boolean }> = ({
className,
error,
...rest
}) => {
const v21Class = classNames("xx-input", "xx-input-search", error && "xx-input-error", className)
return <AntSearch className={v21Class} {...rest} />
}
/** TextArea 文本域 */
const TextArea: React.FC<
React.ComponentProps<typeof AntTextArea> & { error?: boolean }
> = ({ className, error, ...rest }) => {
const v21Class = classNames("xx-input", error && "xx-input-error", className);
return <AntTextArea className={v21Class} {...rest} />;
};
const TextArea: React.FC<React.ComponentProps<typeof AntTextArea> & { error?: boolean }> = ({
className,
error,
...rest
}) => {
const v21Class = classNames("xx-input", error && "xx-input-error", className)
return <AntTextArea className={v21Class} {...rest} />
}
/** Password 密码框 */
const Password = React.forwardRef<
InputRef,
React.ComponentProps<typeof AntPassword> & { error?: boolean }
>(({ className, error, ...rest }, ref) => {
const v21Class = classNames("xx-input", error && "xx-input-error", className);
return <AntPassword ref={ref} className={v21Class} {...rest} />;
});
Password.displayName = "Password";
const v21Class = classNames("xx-input", error && "xx-input-error", className)
return <AntPassword ref={ref} className={v21Class} {...rest} />
})
Password.displayName = "Password"
export default Object.assign(Input, {
Search,
TextArea,
Password,
});
})
+27 -32
View File
@@ -2,74 +2,69 @@
* V21 Modal 对话框
* 封装 Ant Design Modal,应用 V21 设计系统样式
*/
import React from "react";
import { Modal as AntModal } from "antd";
import type { ModalProps as AntModalProps } from "antd";
import type { ModalFuncProps } from "antd/es/modal";
import classNames from "classnames";
import "./ui.css";
import React from "react"
import { Modal as AntModal } from "antd"
import type { ModalProps as AntModalProps } from "antd"
import type { ModalFuncProps } from "antd/es/modal"
import classNames from "classnames"
import "./ui.css"
export interface ModalProps extends AntModalProps {
/** 使用 V21 样式 */
v21?: boolean;
v21?: boolean
}
interface ModalComponent extends React.FC<ModalProps> {
confirm: (config: ModalFuncProps) => ReturnType<typeof AntModal.confirm>;
info: (config: ModalFuncProps) => ReturnType<typeof AntModal.info>;
success: (config: ModalFuncProps) => ReturnType<typeof AntModal.success>;
error: (config: ModalFuncProps) => ReturnType<typeof AntModal.error>;
warning: (config: ModalFuncProps) => ReturnType<typeof AntModal.warning>;
confirm: (config: ModalFuncProps) => ReturnType<typeof AntModal.confirm>
info: (config: ModalFuncProps) => ReturnType<typeof AntModal.info>
success: (config: ModalFuncProps) => ReturnType<typeof AntModal.success>
error: (config: ModalFuncProps) => ReturnType<typeof AntModal.error>
warning: (config: ModalFuncProps) => ReturnType<typeof AntModal.warning>
}
const Modal: ModalComponent = ({
className,
v21 = true,
children,
...rest
}) => {
const v21Class = classNames(v21 && "xx-modal", className);
const Modal: ModalComponent = ({ className, v21 = true, children, ...rest }) => {
const v21Class = classNames(v21 && "xx-modal", className)
return (
<AntModal className={v21Class} {...rest}>
{children}
</AntModal>
);
};
)
}
/** 确认对话框快捷方法 */
Modal.confirm = (config: ModalFuncProps) => {
return AntModal.confirm({
...config,
className: classNames("xx-modal-confirm", config.className),
});
};
})
}
Modal.info = (config: ModalFuncProps) => {
return AntModal.info({
...config,
className: classNames("xx-modal-confirm", config.className),
});
};
})
}
Modal.success = (config: ModalFuncProps) => {
return AntModal.success({
...config,
className: classNames("xx-modal-confirm", config.className),
});
};
})
}
Modal.error = (config: ModalFuncProps) => {
return AntModal.error({
...config,
className: classNames("xx-modal-confirm", config.className),
});
};
})
}
Modal.warning = (config: ModalFuncProps) => {
return AntModal.warning({
...config,
className: classNames("xx-modal-confirm", config.className),
});
};
})
}
export default Modal;
export default Modal
+12 -22
View File
@@ -2,31 +2,21 @@
* V21 Select 选择器
* 封装 Ant Design Select,应用 V21 设计系统样式
*/
import React from "react";
import { Select as AntSelect } from "antd";
import type { SelectProps as AntSelectProps } from "antd";
import classNames from "classnames";
import "./ui.css";
import React from "react"
import { Select as AntSelect } from "antd"
import type { SelectProps as AntSelectProps } from "antd"
import classNames from "classnames"
import "./ui.css"
export interface SelectProps extends AntSelectProps {
/** 自定义弹出层类名 */
dropdownClassName?: string;
dropdownClassName?: string
}
const Select: React.FC<SelectProps> = ({
className,
dropdownClassName,
...rest
}) => {
const v21Class = classNames("xx-select", className);
const v21DropdownClass = classNames("xx-select-dropdown", dropdownClassName);
return (
<AntSelect
className={v21Class}
popupClassName={v21DropdownClass}
{...rest}
/>
);
};
const Select: React.FC<SelectProps> = ({ className, dropdownClassName, ...rest }) => {
const v21Class = classNames("xx-select", className)
const v21DropdownClass = classNames("xx-select-dropdown", dropdownClassName)
return <AntSelect className={v21Class} popupClassName={v21DropdownClass} {...rest} />
}
export default Select;
export default Select
+16 -23
View File
@@ -2,20 +2,17 @@
* V21 Tag 标签 / Badge 徽标
* 封装 Ant Design Tag 和 Badge,应用 V21 设计系统样式
*/
import React from "react";
import { Tag as AntTag, Badge as AntBadge } from "antd";
import type {
TagProps as AntTagProps,
BadgeProps as AntBadgeProps,
} from "antd";
import classNames from "classnames";
import "./ui.css";
import React from "react"
import { Tag as AntTag, Badge as AntBadge } from "antd"
import type { TagProps as AntTagProps, BadgeProps as AntBadgeProps } from "antd"
import classNames from "classnames"
import "./ui.css"
export type TagVariant = "primary" | "success" | "warning" | "error" | "info";
export type TagVariant = "primary" | "success" | "warning" | "error" | "info"
export interface TagProps extends AntTagProps {
/** V21 语义变体 */
variant?: TagVariant;
variant?: TagVariant
}
const VARIANT_CLASS_MAP: Record<TagVariant, string> = {
@@ -24,23 +21,19 @@ const VARIANT_CLASS_MAP: Record<TagVariant, string> = {
warning: "xx-tag-warning",
error: "xx-tag-error",
info: "xx-tag-info",
};
}
/** Tag 标签 */
const Tag: React.FC<TagProps> = ({ className, variant, ...rest }) => {
const v21Class = classNames(
"xx-tag",
variant && VARIANT_CLASS_MAP[variant],
className,
);
return <AntTag className={v21Class} {...rest} />;
};
const v21Class = classNames("xx-tag", variant && VARIANT_CLASS_MAP[variant], className)
return <AntTag className={v21Class} {...rest} />
}
/** Badge 徽标 */
const Badge: React.FC<AntBadgeProps> = ({ className, ...rest }) => {
const v21Class = classNames("xx-badge", className);
return <AntBadge className={v21Class} {...rest} />;
};
const v21Class = classNames("xx-badge", className)
return <AntBadge className={v21Class} {...rest} />
}
export { Tag, Badge };
export default Tag;
export { Tag, Badge }
export default Tag
+18 -26
View File
@@ -2,40 +2,32 @@
* V21 Tooltip 文字提示 / Popover 气泡卡片
* 封装 Ant Design Tooltip 和 Popover,应用 V21 设计系统样式
*/
import React from "react";
import { Tooltip as AntTooltip, Popover as AntPopover } from "antd";
import classNames from "classnames";
import "./ui.css";
import React from "react"
import { Tooltip as AntTooltip, Popover as AntPopover } from "antd"
import classNames from "classnames"
import "./ui.css"
export type TooltipProps = React.ComponentProps<typeof AntTooltip> & {
/** 使用 V21 样式 */
v21?: boolean;
};
v21?: boolean
}
/** Tooltip 文字提示 */
const Tooltip: React.FC<TooltipProps> = ({
overlayClassName,
v21 = true,
...rest
}) => {
const v21Class = classNames(v21 && "xx-tooltip", overlayClassName);
return <AntTooltip overlayClassName={v21Class} {...rest} />;
};
const Tooltip: React.FC<TooltipProps> = ({ overlayClassName, v21 = true, ...rest }) => {
const v21Class = classNames(v21 && "xx-tooltip", overlayClassName)
return <AntTooltip overlayClassName={v21Class} {...rest} />
}
export type PopoverProps = React.ComponentProps<typeof AntPopover> & {
/** 使用 V21 样式 */
v21?: boolean;
};
v21?: boolean
}
/** Popover 气泡卡片 */
const Popover: React.FC<PopoverProps> = ({
overlayClassName,
v21 = true,
...rest
}) => {
const v21Class = classNames(v21 && "xx-popover", overlayClassName);
return <AntPopover overlayClassName={v21Class} {...rest} />;
};
const Popover: React.FC<PopoverProps> = ({ overlayClassName, v21 = true, ...rest }) => {
const v21Class = classNames(v21 && "xx-popover", overlayClassName)
return <AntPopover overlayClassName={v21Class} {...rest} />
}
export { Tooltip, Popover };
export default Tooltip;
export { Tooltip, Popover }
export default Tooltip
+14 -14
View File
@@ -3,23 +3,23 @@
*/
// 组件导出
export { default as Button } from "./Button";
export type { ButtonProps, ButtonType, ButtonSize } from "./Button";
export { default as Button } from "./Button"
export type { ButtonProps, ButtonType, ButtonSize } from "./Button"
export { default as Input } from "./Input";
export type { InputProps } from "./Input";
export { default as Input } from "./Input"
export type { InputProps } from "./Input"
export { default as Select } from "./Select";
export type { SelectProps } from "./Select";
export { default as Select } from "./Select"
export type { SelectProps } from "./Select"
export { default as Modal } from "./Modal";
export type { ModalProps } from "./Modal";
export { default as Modal } from "./Modal"
export type { ModalProps } from "./Modal"
export { default as Card } from "./Card";
export type { CardProps } from "./Card";
export { default as Card } from "./Card"
export type { CardProps } from "./Card"
export { Tag, Badge } from "./Tag";
export type { TagProps, TagVariant } from "./Tag";
export { Tag, Badge } from "./Tag"
export type { TagProps, TagVariant } from "./Tag"
export { Tooltip, Popover } from "./Tooltip";
export type { TooltipProps, PopoverProps } from "./Tooltip";
export { Tooltip, Popover } from "./Tooltip"
export type { TooltipProps, PopoverProps } from "./Tooltip"