This commit is contained in:
2026-05-25 17:08:18 +08:00
parent df501f6151
commit f1259b71b5
9178 changed files with 1626125 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
import * as React from 'react';
declare const Empty: React.FC;
export default Empty;
+59
View File
@@ -0,0 +1,59 @@
"use client";
import * as React from 'react';
import { FastColor } from '@ant-design/fast-color';
import { useLocale } from '../locale';
import { useToken } from '../theme/internal';
const Empty = () => {
const [, token] = useToken();
const [locale] = useLocale('Empty');
const bgColor = new FastColor(token.colorBgBase);
// Dark Theme need more dark of this
const themeStyle = bgColor.toHsl().l < 0.5 ? {
opacity: 0.65
} : {};
return /*#__PURE__*/React.createElement("svg", {
style: themeStyle,
width: "184",
height: "152",
viewBox: "0 0 184 152",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/React.createElement("title", null, locale?.description || 'Empty'), /*#__PURE__*/React.createElement("g", {
fill: "none",
fillRule: "evenodd"
}, /*#__PURE__*/React.createElement("g", {
transform: "translate(24 31.7)"
}, /*#__PURE__*/React.createElement("ellipse", {
fillOpacity: ".8",
fill: "#F5F5F7",
cx: "67.8",
cy: "106.9",
rx: "67.8",
ry: "12.7"
}), /*#__PURE__*/React.createElement("path", {
fill: "#aeb8c2",
d: "M122 69.7 98.1 40.2a6 6 0 0 0-4.6-2.2H42.1a6 6 0 0 0-4.6 2.2l-24 29.5V85H122z"
}), /*#__PURE__*/React.createElement("path", {
fill: "#f5f5f7",
d: "M33.8 0h68a4 4 0 0 1 4 4v93.3a4 4 0 0 1-4 4h-68a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4"
}), /*#__PURE__*/React.createElement("path", {
fill: "#dce0e6",
d: "M42.7 10h50.2a2 2 0 0 1 2 2v25a2 2 0 0 1-2 2H42.7a2 2 0 0 1-2-2V12a2 2 0 0 1 2-2m.2 39.8h49.8a2.3 2.3 0 1 1 0 4.5H42.9a2.3 2.3 0 0 1 0-4.5m0 11.7h49.8a2.3 2.3 0 1 1 0 4.6H42.9a2.3 2.3 0 0 1 0-4.6m79 43.5a7 7 0 0 1-6.8 5.4H20.5a7 7 0 0 1-6.7-5.4l-.2-1.8V69.7h26.3c2.9 0 5.2 2.4 5.2 5.4s2.4 5.4 5.3 5.4h34.8c2.9 0 5.3-2.4 5.3-5.4s2.3-5.4 5.2-5.4H122v33.5q0 1-.2 1.8"
})), /*#__PURE__*/React.createElement("path", {
fill: "#dce0e6",
d: "m149.1 33.3-6.8 2.6a1 1 0 0 1-1.3-1.2l2-6.2q-4.1-4.5-4.2-10.4c0-10 10.1-18.1 22.6-18.1S184 8.1 184 18.1s-10.1 18-22.6 18q-6.8 0-12.3-2.8"
}), /*#__PURE__*/React.createElement("g", {
fill: "#fff",
transform: "translate(149.7 15.4)"
}, /*#__PURE__*/React.createElement("circle", {
cx: "20.7",
cy: "3.2",
r: "2.8"
}), /*#__PURE__*/React.createElement("path", {
d: "M5.7 5.6H0L2.9.7zM9.3.7h5v5h-5z"
}))));
};
if (process.env.NODE_ENV !== 'production') {
Empty.displayName = 'EmptyImage';
}
export default Empty;
+40
View File
@@ -0,0 +1,40 @@
import * as React from 'react';
import type { SemanticClassNamesType, SemanticStylesType } from '../_util/hooks';
export interface TransferLocale {
description: string;
}
export type EmptySemanticName = keyof EmptySemanticClassNames & keyof EmptySemanticStyles;
export type EmptySemanticClassNames = {
root?: string;
image?: string;
description?: string;
footer?: string;
};
export type EmptySemanticStyles = {
root?: React.CSSProperties;
image?: React.CSSProperties;
description?: React.CSSProperties;
footer?: React.CSSProperties;
};
export type EmptyClassNamesType = SemanticClassNamesType<EmptyProps, EmptySemanticClassNames>;
export type EmptyStylesType = SemanticStylesType<EmptyProps, EmptySemanticStyles>;
export type SemanticName = EmptySemanticName;
export interface EmptyProps {
prefixCls?: string;
className?: string;
rootClassName?: string;
style?: React.CSSProperties;
/** @deprecated Please use `styles.image` instead */
imageStyle?: React.CSSProperties;
image?: React.ReactNode;
description?: React.ReactNode;
children?: React.ReactNode;
classNames?: EmptyClassNamesType;
styles?: EmptyStylesType;
}
type CompoundedComponent = React.FC<EmptyProps> & {
PRESENTED_IMAGE_DEFAULT: React.ReactNode;
PRESENTED_IMAGE_SIMPLE: React.ReactNode;
};
declare const Empty: CompoundedComponent;
export default Empty;
+93
View File
@@ -0,0 +1,93 @@
"use client";
import * as React from 'react';
import { clsx } from 'clsx';
import { useMergeSemantic } from '../_util/hooks';
import { devUseWarning } from '../_util/warning';
import { useComponentConfig } from '../config-provider/context';
import { useLocale } from '../locale';
import DefaultEmptyImg from './empty';
import SimpleEmptyImg from './simple';
import useStyle from './style';
const defaultEmptyImg = /*#__PURE__*/React.createElement(DefaultEmptyImg, null);
const simpleEmptyImg = /*#__PURE__*/React.createElement(SimpleEmptyImg, null);
const Empty = props => {
const {
className,
rootClassName,
prefixCls: customizePrefixCls,
image,
description,
children,
imageStyle,
style,
classNames,
styles,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
image: contextImage
} = useComponentConfig('empty');
const prefixCls = getPrefixCls('empty', customizePrefixCls);
const [hashId, cssVarCls] = useStyle(prefixCls);
const [mergedClassNames, mergedStyles] = useMergeSemantic([contextClassNames, classNames], [contextStyles, styles], {
props
});
const [locale] = useLocale('Empty');
const des = typeof description !== 'undefined' ? description : locale?.description;
const alt = typeof des === 'string' ? des : 'empty';
const mergedImage = image ?? contextImage ?? defaultEmptyImg;
let imageNode = null;
if (typeof mergedImage === 'string') {
imageNode = /*#__PURE__*/React.createElement("img", {
draggable: false,
alt: alt,
src: mergedImage
});
} else {
imageNode = mergedImage;
}
// ============================= Warning ==============================
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Empty');
[['imageStyle', 'styles.image']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
return /*#__PURE__*/React.createElement("div", {
className: clsx(hashId, cssVarCls, prefixCls, contextClassName, {
[`${prefixCls}-normal`]: mergedImage === simpleEmptyImg,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, mergedClassNames.root),
style: {
...mergedStyles.root,
...contextStyle,
...style
},
...restProps
}, /*#__PURE__*/React.createElement("div", {
className: clsx(`${prefixCls}-image`, mergedClassNames.image),
style: {
...imageStyle,
...mergedStyles.image
}
}, imageNode), des && (/*#__PURE__*/React.createElement("div", {
className: clsx(`${prefixCls}-description`, mergedClassNames.description),
style: mergedStyles.description
}, des)), children && (/*#__PURE__*/React.createElement("div", {
className: clsx(`${prefixCls}-footer`, mergedClassNames.footer),
style: mergedStyles.footer
}, children)));
};
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
if (process.env.NODE_ENV !== 'production') {
Empty.displayName = 'Empty';
}
export default Empty;
+3
View File
@@ -0,0 +1,3 @@
import * as React from 'react';
declare const Simple: React.FC;
export default Simple;
+54
View File
@@ -0,0 +1,54 @@
"use client";
import * as React from 'react';
import { useMemo } from 'react';
import { FastColor } from '@ant-design/fast-color';
import { useLocale } from '../locale';
import { useToken } from '../theme/internal';
const Simple = () => {
const [, token] = useToken();
const [locale] = useLocale('Empty');
const {
colorFill,
colorFillTertiary,
colorFillQuaternary,
colorBgContainer
} = token;
const {
borderColor,
shadowColor,
contentColor
} = useMemo(() => ({
borderColor: new FastColor(colorFill).onBackground(colorBgContainer).toHexString(),
shadowColor: new FastColor(colorFillTertiary).onBackground(colorBgContainer).toHexString(),
contentColor: new FastColor(colorFillQuaternary).onBackground(colorBgContainer).toHexString()
}), [colorFill, colorFillTertiary, colorFillQuaternary, colorBgContainer]);
return /*#__PURE__*/React.createElement("svg", {
width: "64",
height: "41",
viewBox: "0 0 64 41",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/React.createElement("title", null, locale?.description || 'Empty'), /*#__PURE__*/React.createElement("g", {
transform: "translate(0 1)",
fill: "none",
fillRule: "evenodd"
}, /*#__PURE__*/React.createElement("ellipse", {
fill: shadowColor,
cx: "32",
cy: "33",
rx: "32",
ry: "7"
}), /*#__PURE__*/React.createElement("g", {
fillRule: "nonzero",
stroke: borderColor
}, /*#__PURE__*/React.createElement("path", {
d: "M55 12.8 44.9 1.3Q44 0 42.9 0H21.1q-1.2 0-2 1.3L9 12.8V22h46z"
}), /*#__PURE__*/React.createElement("path", {
d: "M41.6 16c0-1.7 1-3 2.2-3H55v18.1c0 2.2-1.3 3.9-3 3.9H12c-1.7 0-3-1.7-3-3.9V13h11.2c1.2 0 2.2 1.3 2.2 3s1 2.9 2.2 2.9h14.8c1.2 0 2.2-1.4 2.2-3",
fill: contentColor
}))));
};
if (process.env.NODE_ENV !== 'production') {
Simple.displayName = 'SimpleImage';
}
export default Simple;
+5
View File
@@ -0,0 +1,5 @@
/** Component only token. Which will handle additional calculation of alias token */
export interface ComponentToken {
}
declare const _default: (prefixCls: string, rootCls?: string) => readonly [string, string];
export default _default;
+73
View File
@@ -0,0 +1,73 @@
import { genStyleHooks, mergeToken } from '../../theme/internal';
// ============================== Shared ==============================
const genSharedEmptyStyle = token => {
const {
componentCls,
margin,
marginXS,
marginXL,
fontSize,
lineHeight
} = token;
return {
[componentCls]: {
marginInline: marginXS,
fontSize,
lineHeight,
textAlign: 'center',
// 原来 &-image 没有父子结构,现在为了外层承担我们的 hashId,改成父子结构
[`${componentCls}-image`]: {
height: token.emptyImgHeight,
marginBottom: marginXS,
opacity: token.opacityImage,
img: {
height: '100%'
},
svg: {
maxWidth: '100%',
height: '100%',
margin: 'auto'
}
},
[`${componentCls}-description`]: {
color: token.colorTextDescription
},
// 原来 &-footer 没有父子结构,现在为了外层承担我们的 hashId,改成父子结构
[`${componentCls}-footer`]: {
marginTop: margin
},
'&-normal': {
marginBlock: marginXL,
color: token.colorTextDescription,
[`${componentCls}-description`]: {
color: token.colorTextDescription
},
[`${componentCls}-image`]: {
height: token.emptyImgHeightMD
}
},
'&-small': {
marginBlock: marginXS,
color: token.colorTextDescription,
[`${componentCls}-image`]: {
height: token.emptyImgHeightSM
}
}
}
};
};
// ============================== Export ==============================
export default genStyleHooks('Empty', token => {
const {
componentCls,
controlHeightLG,
calc
} = token;
const emptyToken = mergeToken(token, {
emptyImgCls: `${componentCls}-img`,
emptyImgHeight: calc(controlHeightLG).mul(2.5).equal(),
emptyImgHeightMD: controlHeightLG,
emptyImgHeightSM: calc(controlHeightLG).mul(0.875).equal()
});
return genSharedEmptyStyle(emptyToken);
});