1
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
import * as React from 'react';
|
||||
declare const Empty: React.FC;
|
||||
export default Empty;
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _fastColor = require("@ant-design/fast-color");
|
||||
var _locale = require("../locale");
|
||||
var _internal = require("../theme/internal");
|
||||
const Empty = () => {
|
||||
const [, token] = (0, _internal.useToken)();
|
||||
const [locale] = (0, _locale.useLocale)('Empty');
|
||||
const bgColor = new _fastColor.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';
|
||||
}
|
||||
var _default = exports.default = Empty;
|
||||
+40
@@ -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;
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = require("clsx");
|
||||
var _hooks = require("../_util/hooks");
|
||||
var _warning = require("../_util/warning");
|
||||
var _context = require("../config-provider/context");
|
||||
var _locale = require("../locale");
|
||||
var _empty = _interopRequireDefault(require("./empty"));
|
||||
var _simple = _interopRequireDefault(require("./simple"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
const defaultEmptyImg = /*#__PURE__*/React.createElement(_empty.default, null);
|
||||
const simpleEmptyImg = /*#__PURE__*/React.createElement(_simple.default, 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
|
||||
} = (0, _context.useComponentConfig)('empty');
|
||||
const prefixCls = getPrefixCls('empty', customizePrefixCls);
|
||||
const [hashId, cssVarCls] = (0, _style.default)(prefixCls);
|
||||
const [mergedClassNames, mergedStyles] = (0, _hooks.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
|
||||
props
|
||||
});
|
||||
const [locale] = (0, _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 = (0, _warning.devUseWarning)('Empty');
|
||||
[['imageStyle', 'styles.image']].forEach(([deprecatedName, newName]) => {
|
||||
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
className: (0, _clsx.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: (0, _clsx.clsx)(`${prefixCls}-image`, mergedClassNames.image),
|
||||
style: {
|
||||
...imageStyle,
|
||||
...mergedStyles.image
|
||||
}
|
||||
}, imageNode), des && (/*#__PURE__*/React.createElement("div", {
|
||||
className: (0, _clsx.clsx)(`${prefixCls}-description`, mergedClassNames.description),
|
||||
style: mergedStyles.description
|
||||
}, des)), children && (/*#__PURE__*/React.createElement("div", {
|
||||
className: (0, _clsx.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';
|
||||
}
|
||||
var _default = exports.default = Empty;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import * as React from 'react';
|
||||
declare const Simple: React.FC;
|
||||
export default Simple;
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var React = _react;
|
||||
var _fastColor = require("@ant-design/fast-color");
|
||||
var _locale = require("../locale");
|
||||
var _internal = require("../theme/internal");
|
||||
const Simple = () => {
|
||||
const [, token] = (0, _internal.useToken)();
|
||||
const [locale] = (0, _locale.useLocale)('Empty');
|
||||
const {
|
||||
colorFill,
|
||||
colorFillTertiary,
|
||||
colorFillQuaternary,
|
||||
colorBgContainer
|
||||
} = token;
|
||||
const {
|
||||
borderColor,
|
||||
shadowColor,
|
||||
contentColor
|
||||
} = (0, _react.useMemo)(() => ({
|
||||
borderColor: new _fastColor.FastColor(colorFill).onBackground(colorBgContainer).toHexString(),
|
||||
shadowColor: new _fastColor.FastColor(colorFillTertiary).onBackground(colorBgContainer).toHexString(),
|
||||
contentColor: new _fastColor.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';
|
||||
}
|
||||
var _default = exports.default = Simple;
|
||||
+5
@@ -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;
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _internal = require("../../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 ==============================
|
||||
var _default = exports.default = (0, _internal.genStyleHooks)('Empty', token => {
|
||||
const {
|
||||
componentCls,
|
||||
controlHeightLG,
|
||||
calc
|
||||
} = token;
|
||||
const emptyToken = (0, _internal.mergeToken)(token, {
|
||||
emptyImgCls: `${componentCls}-img`,
|
||||
emptyImgHeight: calc(controlHeightLG).mul(2.5).equal(),
|
||||
emptyImgHeightMD: controlHeightLG,
|
||||
emptyImgHeightSM: calc(controlHeightLG).mul(0.875).equal()
|
||||
});
|
||||
return genSharedEmptyStyle(emptyToken);
|
||||
});
|
||||
Reference in New Issue
Block a user