Update from Vibe Studio

This commit is contained in:
Vibe Studio
2026-01-12 09:12:41 +00:00
parent a4605e311a
commit a6ae5199b0
29756 changed files with 2526222 additions and 278 deletions

View File

@@ -0,0 +1,13 @@
import React from 'react';
export type ProCardActionsProps = {
/**
* 自定义前缀
*
* @ignore
*/
prefixCls?: string;
/** 操作按钮 */
actions?: React.ReactNode[] | React.ReactNode;
};
declare const ProCardActions: React.FC<ProCardActionsProps>;
export default ProCardActions;

View File

@@ -0,0 +1,36 @@
import classNames from 'classnames';
import React from 'react';
import useStyle from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
var ProCardActions = function ProCardActions(props) {
var actions = props.actions,
prefixCls = props.prefixCls;
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
if (Array.isArray(actions) && actions !== null && actions !== void 0 && actions.length) {
return wrapSSR( /*#__PURE__*/_jsx("ul", {
className: classNames("".concat(prefixCls, "-actions"), hashId),
children: actions.map(function (action, index) {
return (
/*#__PURE__*/
// eslint-disable-next-line react/no-array-index-key
_jsx("li", {
style: {
width: "".concat(100 / actions.length, "%"),
padding: 0,
margin: 0
},
className: classNames("".concat(prefixCls, "-actions-item"), hashId),
children: action
}, "action-".concat(index))
);
})
}));
}
return wrapSSR( /*#__PURE__*/_jsx("ul", {
className: classNames("".concat(prefixCls, "-actions"), hashId),
children: actions
}));
};
export default ProCardActions;

View File

@@ -0,0 +1,5 @@
/// <reference types="react" />
export default function useStyle(prefixCls?: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,80 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
var genActionsStyle = function genActionsStyle(token) {
var componentCls = token.componentCls,
antCls = token.antCls;
return _defineProperty({}, "".concat(componentCls, "-actions"), _defineProperty(_defineProperty({
marginBlock: 0,
marginInline: 0,
paddingBlock: 0,
paddingInline: 0,
listStyle: 'none',
display: 'flex',
gap: token.marginXS,
background: token.colorBgContainer,
borderBlockStart: "".concat(token.lineWidth, "px ").concat(token.lineType, " ").concat(token.colorSplit),
minHeight: 42
}, "& > *", {
alignItems: 'center',
justifyContent: 'center',
flex: 1,
display: 'flex',
cursor: 'pointer',
color: token.colorTextSecondary,
transition: 'color 0.3s',
'&:hover': {
color: token.colorPrimaryHover
}
}), "& > li > div", {
flex: 1,
width: '100%',
marginBlock: token.marginSM,
marginInline: 0,
color: token.colorTextSecondary,
textAlign: 'center',
a: {
color: token.colorTextSecondary,
transition: 'color 0.3s',
'&:hover': {
color: token.colorPrimaryHover
}
},
div: _defineProperty(_defineProperty({
position: 'relative',
display: 'block',
minWidth: 32,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
cursor: 'pointer',
'&:hover': {
color: token.colorPrimaryHover,
transition: 'color 0.3s'
}
}, "a:not(".concat(antCls, "-btn),\n > .anticon"), {
display: 'inline-block',
width: '100%',
color: token.colorTextSecondary,
lineHeight: '22px',
transition: 'color 0.3s',
'&:hover': {
color: token.colorPrimaryHover
}
}), '.anticon', {
fontSize: token.cardActionIconSize,
lineHeight: '22px'
}),
'&:not(:last-child)': {
borderInlineEnd: "".concat(token.lineWidth, "px ").concat(token.lineType, " ").concat(token.colorSplit)
}
}));
};
export default function useStyle(prefixCls) {
return useAntdStyle('ProCardActions', function (token) {
var proCardActionsToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls),
cardActionIconSize: 16
});
return [genActionsStyle(proCardActionsToken)];
});
}

View File

@@ -0,0 +1,4 @@
import React from 'react';
import type { CardProps } from '../../typing';
declare const Card: React.ForwardRefExoticComponent<Omit<CardProps, "ref"> & React.RefAttributes<unknown>>;
export default Card;

View File

@@ -0,0 +1,254 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["className", "style", "bodyStyle", "headStyle", "title", "subTitle", "extra", "wrap", "layout", "loading", "gutter", "tooltip", "split", "headerBordered", "bordered", "boxShadow", "children", "size", "actions", "ghost", "hoverable", "direction", "collapsed", "collapsible", "collapsibleIconRender", "colStyle", "defaultCollapsed", "onCollapse", "checked", "onChecked", "tabs", "type"];
import { RightOutlined } from '@ant-design/icons';
import { LabelIconTip } from '@ant-design/pro-utils';
import { ConfigProvider, Tabs } from 'antd';
import useBreakpoint from 'antd/es/grid/hooks/useBreakpoint';
import classNames from 'classnames';
import useMergedState from "rc-util/es/hooks/useMergedState";
import omit from "rc-util/es/omit";
import React, { useContext } from 'react';
import Actions from "../Actions";
import Loading from "../Loading";
import { useLegacyItems } from "../TabPane";
import useStyle from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _classNames2;
var className = props.className,
style = props.style,
bodyStyle = props.bodyStyle,
headStyle = props.headStyle,
title = props.title,
subTitle = props.subTitle,
extra = props.extra,
_props$wrap = props.wrap,
wrap = _props$wrap === void 0 ? false : _props$wrap,
layout = props.layout,
loading = props.loading,
_props$gutter = props.gutter,
gutter = _props$gutter === void 0 ? 0 : _props$gutter,
tooltip = props.tooltip,
split = props.split,
_props$headerBordered = props.headerBordered,
headerBordered = _props$headerBordered === void 0 ? false : _props$headerBordered,
_props$bordered = props.bordered,
bordered = _props$bordered === void 0 ? false : _props$bordered,
_props$boxShadow = props.boxShadow,
boxShadow = _props$boxShadow === void 0 ? false : _props$boxShadow,
children = props.children,
size = props.size,
actions = props.actions,
_props$ghost = props.ghost,
ghost = _props$ghost === void 0 ? false : _props$ghost,
_props$hoverable = props.hoverable,
hoverable = _props$hoverable === void 0 ? false : _props$hoverable,
direction = props.direction,
controlCollapsed = props.collapsed,
_props$collapsible = props.collapsible,
collapsible = _props$collapsible === void 0 ? false : _props$collapsible,
collapsibleIconRender = props.collapsibleIconRender,
colStyle = props.colStyle,
_props$defaultCollaps = props.defaultCollapsed,
defaultCollapsed = _props$defaultCollaps === void 0 ? false : _props$defaultCollaps,
onCollapse = props.onCollapse,
checked = props.checked,
onChecked = props.onChecked,
tabs = props.tabs,
type = props.type,
rest = _objectWithoutProperties(props, _excluded);
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var screens = useBreakpoint() || {
lg: true,
md: true,
sm: true,
xl: false,
xs: false,
xxl: false
};
var _useMergedState = useMergedState(defaultCollapsed, {
value: controlCollapsed,
onChange: onCollapse
}),
_useMergedState2 = _slicedToArray(_useMergedState, 2),
collapsed = _useMergedState2[0],
setCollapsed = _useMergedState2[1];
// 顺序决定如何进行响应式取值,按最大响应值依次取值,请勿修改。
var responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
// 修改组合传给antd tabs的参数
// @ts-ignore
var ModifyTabItemsContent = useLegacyItems(tabs === null || tabs === void 0 ? void 0 : tabs.items, children, tabs);
/**
* 根据响应式获取 gutter, 参考 antd 实现
*
* @param gutter Gutter
*/
var getNormalizedGutter = function getNormalizedGutter(gut) {
var results = [0, 0];
var normalizedGutter = Array.isArray(gut) ? gut : [gut, 0];
normalizedGutter.forEach(function (g, index) {
if (_typeof(g) === 'object') {
for (var i = 0; i < responsiveArray.length; i += 1) {
var breakpoint = responsiveArray[i];
if (screens[breakpoint] && g[breakpoint] !== undefined) {
results[index] = g[breakpoint];
break;
}
}
} else {
results[index] = g || 0;
}
});
return results;
};
/**
* 根据条件返回 style负责返回空对象
*
* @param withStyle 是否符合条件
* @param appendStyle 如果符合条件要返回的 style 属性
*/
var getStyle = function getStyle(withStyle, appendStyle) {
return withStyle ? appendStyle : {};
};
var getColSpanStyle = function getColSpanStyle(colSpan) {
var span = colSpan;
// colSpan 响应式
if (_typeof(colSpan) === 'object') {
for (var i = 0; i < responsiveArray.length; i += 1) {
var breakpoint = responsiveArray[i];
if (screens !== null && screens !== void 0 && screens[breakpoint] && (colSpan === null || colSpan === void 0 ? void 0 : colSpan[breakpoint]) !== undefined) {
span = colSpan[breakpoint];
break;
}
}
}
// 当 colSpan 为 30% 或 300px 时
var colSpanStyle = getStyle(typeof span === 'string' && /\d%|\dpx/i.test(span), {
width: span,
flexShrink: 0
});
return {
span: span,
colSpanStyle: colSpanStyle
};
};
var prefixCls = getPrefixCls('pro-card');
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var _getNormalizedGutter = getNormalizedGutter(gutter),
_getNormalizedGutter2 = _slicedToArray(_getNormalizedGutter, 2),
horizontalGutter = _getNormalizedGutter2[0],
verticalGutter = _getNormalizedGutter2[1];
// 判断是否套了卡片,如果套了的话将自身卡片内部内容的 padding 设置为0
var containProCard = false;
var childrenArray = React.Children.toArray(children);
var childrenModified = childrenArray.map(function (element, index) {
var _element$type;
if (element !== null && element !== void 0 && (_element$type = element.type) !== null && _element$type !== void 0 && _element$type.isProCard) {
containProCard = true;
// 宽度
var colSpan = element.props.colSpan;
var _getColSpanStyle = getColSpanStyle(colSpan),
span = _getColSpanStyle.span,
colSpanStyle = _getColSpanStyle.colSpanStyle;
var columnClassName = classNames(["".concat(prefixCls, "-col")], hashId, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-split-vertical"), split === 'vertical' && index !== childrenArray.length - 1), "".concat(prefixCls, "-split-horizontal"), split === 'horizontal' && index !== childrenArray.length - 1), "".concat(prefixCls, "-col-").concat(span), typeof span === 'number' && span >= 0 && span <= 24));
var wrappedElement = wrapSSR( /*#__PURE__*/_jsx("div", {
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, colSpanStyle), getStyle(horizontalGutter > 0, {
paddingInlineEnd: horizontalGutter / 2,
paddingInlineStart: horizontalGutter / 2
})), getStyle(verticalGutter > 0, {
paddingBlockStart: verticalGutter / 2,
paddingBlockEnd: verticalGutter / 2
})), colStyle),
className: columnClassName,
children: /*#__PURE__*/React.cloneElement(element)
}));
return /*#__PURE__*/React.cloneElement(wrappedElement, {
key: "pro-card-col-".concat((element === null || element === void 0 ? void 0 : element.key) || index)
});
}
return element;
});
var cardCls = classNames("".concat(prefixCls), className, hashId, (_classNames2 = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classNames2, "".concat(prefixCls, "-border"), bordered), "".concat(prefixCls, "-box-shadow"), boxShadow), "".concat(prefixCls, "-contain-card"), containProCard), "".concat(prefixCls, "-loading"), loading), "".concat(prefixCls, "-split"), split === 'vertical' || split === 'horizontal'), "".concat(prefixCls, "-ghost"), ghost), "".concat(prefixCls, "-hoverable"), hoverable), "".concat(prefixCls, "-size-").concat(size), size), "".concat(prefixCls, "-type-").concat(type), type), "".concat(prefixCls, "-collapse"), collapsed), _defineProperty(_classNames2, "".concat(prefixCls, "-checked"), checked)));
var bodyCls = classNames("".concat(prefixCls, "-body"), hashId, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-body-center"), layout === 'center'), "".concat(prefixCls, "-body-direction-column"), split === 'horizontal' || direction === 'column'), "".concat(prefixCls, "-body-wrap"), wrap && containProCard));
var cardBodyStyle = bodyStyle;
var loadingDOM = /*#__PURE__*/React.isValidElement(loading) ? loading : /*#__PURE__*/_jsx(Loading, {
prefix: prefixCls,
style: (bodyStyle === null || bodyStyle === void 0 ? void 0 : bodyStyle.padding) === 0 || (bodyStyle === null || bodyStyle === void 0 ? void 0 : bodyStyle.padding) === '0px' ? {
padding: 24
} : undefined
});
// 非受控情况下展示
var collapsibleButton = collapsible && controlCollapsed === undefined && (collapsibleIconRender ? collapsibleIconRender({
collapsed: collapsed
}) : /*#__PURE__*/_jsx(RightOutlined, {
onClick: function onClick() {
if (collapsible === 'icon') setCollapsed(!collapsed);
},
rotate: !collapsed ? 90 : undefined,
className: "".concat(prefixCls, "-collapsible-icon ").concat(hashId).trim()
}));
return wrapSSR( /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
className: cardCls,
style: style,
ref: ref,
onClick: function onClick(e) {
var _rest$onClick;
onChecked === null || onChecked === void 0 || onChecked(e);
rest === null || rest === void 0 || (_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 || _rest$onClick.call(rest, e);
}
}, omit(rest, ['prefixCls', 'colSpan'])), {}, {
children: [(title || extra || collapsibleButton) && /*#__PURE__*/_jsxs("div", {
className: classNames("".concat(prefixCls, "-header"), hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-header-border"), headerBordered || type === 'inner'), "".concat(prefixCls, "-header-collapsible"), collapsibleButton)),
style: headStyle,
onClick: function onClick() {
if (collapsible === 'header' || collapsible === true) setCollapsed(!collapsed);
},
children: [/*#__PURE__*/_jsxs("div", {
className: "".concat(prefixCls, "-title ").concat(hashId).trim(),
children: [collapsibleButton, /*#__PURE__*/_jsx(LabelIconTip, {
label: title,
tooltip: tooltip,
subTitle: subTitle
})]
}), extra && /*#__PURE__*/_jsx("div", {
className: "".concat(prefixCls, "-extra ").concat(hashId).trim(),
onClick: function onClick(e) {
return e.stopPropagation();
},
children: extra
})]
}), tabs ? /*#__PURE__*/_jsx("div", {
className: "".concat(prefixCls, "-tabs ").concat(hashId).trim(),
children: /*#__PURE__*/_jsx(Tabs, _objectSpread(_objectSpread({
onChange: tabs.onChange
}, omit(tabs, ['cardProps'])), {}, {
// @ts-ignore
items: ModifyTabItemsContent,
children: loading ? loadingDOM : children
}))
}) : /*#__PURE__*/_jsx("div", {
className: bodyCls,
style: cardBodyStyle,
children: loading ? loadingDOM : childrenModified
}), actions ? /*#__PURE__*/_jsx(Actions, {
actions: actions,
prefixCls: prefixCls
}) : null]
})));
});
export default Card;

View File

@@ -0,0 +1,5 @@
/// <reference types="react" />
export default function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,209 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { resetComponent, useStyle as useAntdStyle } from '@ant-design/pro-utils';
var genActiveStyle = function genActiveStyle(token) {
return {
backgroundColor: token.controlItemBgActive,
borderColor: token.controlOutline
};
};
var genProCardStyle = function genProCardStyle(token) {
var componentCls = token.componentCls;
return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _objectSpread(_objectSpread({
position: 'relative',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box',
width: '100%',
marginBlock: 0,
marginInline: 0,
paddingBlock: 0,
paddingInline: 0,
backgroundColor: token.colorBgContainer,
borderRadius: token.borderRadius,
transition: 'all 0.3s'
}, resetComponent === null || resetComponent === void 0 ? void 0 : resetComponent(token)), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
'&-box-shadow': {
boxShadow: '0 1px 2px -2px #00000029, 0 3px 6px #0000001f, 0 5px 12px 4px #00000017',
borderColor: 'transparent'
},
'&-col': {
width: '100%'
},
'&-border': {
border: "".concat(token.lineWidth, "px ").concat(token.lineType, " ").concat(token.colorSplit)
},
'&-hoverable': _defineProperty({
cursor: 'pointer',
transition: 'box-shadow 0.3s, border-color 0.3s',
'&:hover': {
borderColor: 'transparent',
boxShadow: '0 1px 2px -2px #00000029, 0 3px 6px #0000001f, 0 5px 12px 4px #00000017'
}
}, "&".concat(componentCls, "-checked:hover"), {
borderColor: token.controlOutline
}),
'&-checked': _objectSpread(_objectSpread({}, genActiveStyle(token)), {}, {
'&::after': {
visibility: 'visible',
position: 'absolute',
insetBlockStart: 2,
insetInlineEnd: 2,
opacity: 1,
width: 0,
height: 0,
border: "6px solid ".concat(token.colorPrimary),
borderBlockEnd: '6px solid transparent',
borderInlineStart: '6px solid transparent',
borderStartEndRadius: 2,
content: '""'
}
}),
'&:focus': _objectSpread({}, genActiveStyle(token)),
'&&-ghost': _defineProperty({
backgroundColor: 'transparent'
}, "> ".concat(componentCls), {
'&-header': {
paddingInlineEnd: 0,
paddingBlockEnd: token.padding,
paddingInlineStart: 0
},
'&-body': {
paddingBlock: 0,
paddingInline: 0,
backgroundColor: 'transparent'
}
}),
'&&-split > &-body': {
paddingBlock: 0,
paddingInline: 0
},
'&&-contain-card > &-body': {
display: 'flex'
}
}, "".concat(componentCls, "-body-direction-column"), {
flexDirection: 'column'
}), "".concat(componentCls, "-body-wrap"), {
flexWrap: 'wrap'
}), '&&-collapse', _defineProperty({}, "> ".concat(componentCls), {
'&-header': {
paddingBlockEnd: token.padding,
borderBlockEnd: 0
},
'&-body': {
display: 'none'
}
})), "".concat(componentCls, "-header"), {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
paddingInline: token.paddingLG,
paddingBlock: token.padding,
paddingBlockEnd: 0,
'&-border': {
'&': {
paddingBlockEnd: token.padding
},
borderBlockEnd: "".concat(token.lineWidth, "px ").concat(token.lineType, " ").concat(token.colorSplit)
},
'&-collapsible': {
cursor: 'pointer'
}
}), "".concat(componentCls, "-title"), {
color: token.colorText,
fontWeight: 500,
fontSize: token.fontSizeLG,
lineHeight: token.lineHeight
}), "".concat(componentCls, "-extra"), {
color: token.colorText
}), "".concat(componentCls, "-type-inner"), _defineProperty({}, "".concat(componentCls, "-header"), {
backgroundColor: token.colorFillAlter
})), "".concat(componentCls, "-collapsible-icon"), {
marginInlineEnd: token.marginXS,
color: token.colorIconHover,
':hover': {
color: token.colorPrimaryHover
},
'& svg': {
transition: "transform ".concat(token.motionDurationMid)
}
}), "".concat(componentCls, "-body"), {
display: 'block',
boxSizing: 'border-box',
height: '100%',
paddingInline: token.paddingLG,
paddingBlock: token.padding,
'&-center': {
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}
}), '&&-size-small', _defineProperty(_defineProperty({}, componentCls, {
'&-header': {
paddingInline: token.paddingSM,
paddingBlock: token.paddingXS,
paddingBlockEnd: 0,
'&-border': {
paddingBlockEnd: token.paddingXS
}
},
'&-title': {
fontSize: token.fontSize
},
'&-body': {
paddingInline: token.paddingSM,
paddingBlock: token.paddingSM
}
}), "".concat(componentCls, "-header").concat(componentCls, "-header-collapsible"), {
paddingBlock: token.paddingXS
})))), "".concat(componentCls, "-col"), _defineProperty(_defineProperty({}, "&".concat(componentCls, "-split-vertical"), {
borderInlineEnd: "".concat(token.lineWidth, "px ").concat(token.lineType, " ").concat(token.colorSplit)
}), "&".concat(componentCls, "-split-horizontal"), {
borderBlockEnd: "".concat(token.lineWidth, "px ").concat(token.lineType, " ").concat(token.colorSplit)
})), "".concat(componentCls, "-tabs"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(token.antCls, "-tabs-top > ").concat(token.antCls, "-tabs-nav"), _defineProperty({
marginBlockEnd: 0
}, "".concat(token.antCls, "-tabs-nav-list"), {
marginBlockStart: token.marginXS,
paddingInlineStart: token.padding
})), "".concat(token.antCls, "-tabs-bottom > ").concat(token.antCls, "-tabs-nav"), _defineProperty({
marginBlockEnd: 0
}, "".concat(token.antCls, "-tabs-nav-list"), {
paddingInlineStart: token.padding
})), "".concat(token.antCls, "-tabs-left"), _defineProperty({}, "".concat(token.antCls, "-tabs-content-holder"), _defineProperty({}, "".concat(token.antCls, "-tabs-content"), _defineProperty({}, "".concat(token.antCls, "-tabs-tabpane"), {
paddingInlineStart: 0
})))), "".concat(token.antCls, "-tabs-left > ").concat(token.antCls, "-tabs-nav"), _defineProperty({
marginInlineEnd: 0
}, "".concat(token.antCls, "-tabs-nav-list"), {
paddingBlockStart: token.padding
})), "".concat(token.antCls, "-tabs-right"), _defineProperty({}, "".concat(token.antCls, "-tabs-content-holder"), _defineProperty({}, "".concat(token.antCls, "-tabs-content"), _defineProperty({}, "".concat(token.antCls, "-tabs-tabpane"), {
paddingInlineStart: 0
})))), "".concat(token.antCls, "-tabs-right > ").concat(token.antCls, "-tabs-nav"), _defineProperty({}, "".concat(token.antCls, "-tabs-nav-list"), {
paddingBlockStart: token.padding
})));
};
var GRID_COLUMNS = 24;
var genColStyle = function genColStyle(index, token) {
var componentCls = token.componentCls;
if (index === 0) {
return _defineProperty({}, "".concat(componentCls, "-col-0"), {
display: 'none'
});
}
return _defineProperty({}, "".concat(componentCls, "-col-").concat(index), {
flexShrink: 0,
width: "".concat(index / GRID_COLUMNS * 100, "%")
});
};
var genGridStyle = function genGridStyle(token) {
return Array(GRID_COLUMNS + 1).fill(1).map(function (_, index) {
return genColStyle(index, token);
});
};
export default function useStyle(prefixCls) {
return useAntdStyle('ProCard', function (token) {
var proCardToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProCardStyle(proCardToken), genGridStyle(proCardToken)];
});
}

View File

@@ -0,0 +1,183 @@
import React from 'react';
export type CheckCardValueType = string | number | boolean;
/**
* Represents the possible value types for a CheckGroup.
* It can be an array of CheckCardValueTypes, a single CheckCardValueType, or undefined.
*/
export type CheckGroupValueType = CheckCardValueType[] | CheckCardValueType | undefined;
/**
* Represents an option for a CheckCard component.
*/
export interface CheckCardOptionType {
/**
* The title to be displayed.
*
* @title Title
*/
title?: React.ReactNode;
/**
* The value of the option.
*
* @title Value
*/
value: CheckCardValueType;
/**
* The description to be displayed.
*
* @title Description
*/
description?: React.ReactNode;
/**
* The size of the component. Supports three default sizes: 'large', 'default', 'small'.
* Users can also customize the width and height.
*
* @default default
* @title Component Size
*/
size?: 'large' | 'default' | 'small';
/**
* The avatar to be displayed on the left side. Can be a link or a ReactNode.
*
* @title Left Avatar Area
*/
avatar?: React.ReactNode;
/**
* The cover image. In this mode, other display values are ignored.
*
* @title Cover Image
*/
cover?: React.ReactNode;
/**
* Specifies if the option is disabled.
*
* @default false
* @title Disabled
*/
disabled?: boolean;
/**
* Change callback function.
*
* @param checked - Indicates whether the option is checked or not.
* @title Change Callback
*/
onChange?: (checked: boolean) => void;
/**
* Child options.
*/
children?: CheckCardOptionType[];
}
export interface AbstractCheckCardGroupProps {
/** @ignore */
prefixCls?: string;
/** @ignore */
className?: string;
/** 指定可选项 */
options?: (CheckCardOptionType | string)[];
/** 整组失效 */
disabled?: boolean;
/** @ignore */
style?: React.CSSProperties;
/**
* 组件尺寸,支持大,中,小三种默认尺寸,用户可以自定义宽高
*
* @default default
*/
size?: 'large' | 'default' | 'small';
/**
* @acceptions CheckCard
* @ignore
*/
children?: React.ReactNode;
}
export declare const CardLoading: React.FC<{
prefixCls: string;
hashId: string;
}>;
export interface CheckCardGroupProps extends AbstractCheckCardGroupProps {
/**
* 是否多选
*
* @title 是否多选
*/
multiple?: boolean;
/**
* 默认选中的选项
*
* @title 默认选中的选项
*/
defaultValue?: CheckGroupValueType;
/**
* 指定选中的选项
*
* @title 指定选中的选项
*/
value?: CheckGroupValueType;
/**
* 当卡片组内容还在加载中时,可以用 loading 展示一个占位
*
* @title 加载中
*/
loading?: boolean;
/**
* 是否显示边框
*
* @title 显示边框
*/
bordered?: boolean;
/** 变化时回调函数 */
onChange?: (checkedValue: CheckGroupValueType) => void;
}
/**
* Represents the state of a CheckCardGroup component.
*/
export interface CheckCardGroupState {
value: CheckGroupValueType;
registeredValues: CheckCardValueType[];
}
/**
* Represents the props for the CheckCardGroup component.
*/
export type CheckCardGroupConnextType = {
/**
* A function to toggle the selected option.
* @param option - The option to toggle.
*/
toggleOption?: (option: CheckCardOptionType) => void;
/**
* The currently selected value.
*/
value?: any;
/**
* Specifies whether the component is disabled.
*/
disabled?: boolean;
/**
* The size of the component.
*/
size?: any;
/**
* Specifies whether the component is in a loading state.
*/
loading?: any;
/**
* Specifies whether the component has a border.
*/
bordered?: any;
/**
* Specifies whether multiple options can be selected.
*/
multiple?: any;
/**
* A function to register a value.
* @param value - The value to register.
*/
registerValue?: (value: any) => void;
/**
* A function to cancel a value.
* @param value - The value to cancel.
*/
cancelValue?: (value: any) => void;
};
export declare const CheckCardGroupConnext: React.Context<CheckCardGroupConnextType>;
declare const _default: (props: CheckCardGroupProps) => import("react/jsx-runtime").JSX.Element;
export default _default;

View File

@@ -0,0 +1,245 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
var _excluded = ["prefixCls", "className", "style", "options", "loading", "multiple", "bordered", "onChange"];
import { useMountMergeState } from '@ant-design/pro-utils';
import { ConfigProvider, Skeleton } from 'antd';
import { RightOutlined } from '@ant-design/icons';
import { ProConfigProvider, proTheme } from '@ant-design/pro-provider';
import classNames from 'classnames';
import omit from "rc-util/es/omit";
import React, { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';
import CheckCard from "./index";
import { useStyle } from "./style";
/**
* Represents the possible value types for a CheckGroup.
* It can be an array of CheckCardValueTypes, a single CheckCardValueType, or undefined.
*/
/**
* Represents an option for a CheckCard component.
*/
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export var CardLoading = function CardLoading(_ref) {
var prefixCls = _ref.prefixCls,
hashId = _ref.hashId;
return /*#__PURE__*/_jsx("div", {
className: classNames("".concat(prefixCls, "-loading-content"), hashId),
children: /*#__PURE__*/_jsx(Skeleton, {
loading: true,
active: true,
paragraph: {
rows: 4
},
title: false
})
});
};
/**
* Represents the state of a CheckCardGroup component.
*/
/**
* Represents the props for the CheckCardGroup component.
*/
export var CheckCardGroupConnext = /*#__PURE__*/createContext(null);
/**
* SubCheckCardGroup component.
*
* @component
* @param {React.ReactNode} title - The title of the group.
* @param {React.ReactNode} children - The content of the group.
* @param {string} prefix - The prefix for CSS class names.
* @returns {React.ReactNode} The rendered SubCheckCardGroup component.
*/
var SubCheckCardGroup = function SubCheckCardGroup(props) {
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
collapse = _useState2[0],
setCollapse = _useState2[1];
var _proTheme$useToken = proTheme.useToken(),
hashId = _proTheme$useToken.hashId;
var baseCls = "".concat(props.prefix, "-sub-check-card");
return /*#__PURE__*/_jsxs("div", {
className: classNames(baseCls, hashId),
children: [/*#__PURE__*/_jsxs("div", {
className: classNames("".concat(baseCls, "-title"), hashId),
onClick: function onClick() {
setCollapse(!collapse);
},
children: [/*#__PURE__*/_jsx(RightOutlined, {
style: {
transform: "rotate(".concat(collapse ? 90 : 0, "deg)"),
transition: 'transform 0.3s'
}
}), props.title]
}), /*#__PURE__*/_jsx("div", {
className: classNames("".concat(baseCls, "-panel"), hashId, _defineProperty({}, "".concat(baseCls, "-panel-collapse"), collapse)),
children: props.children
})]
});
};
var CheckCardGroup = function CheckCardGroup(props) {
var customizePrefixCls = props.prefixCls,
className = props.className,
style = props.style,
_props$options = props.options,
options = _props$options === void 0 ? [] : _props$options,
_props$loading = props.loading,
loading = _props$loading === void 0 ? false : _props$loading,
_props$multiple = props.multiple,
multiple = _props$multiple === void 0 ? false : _props$multiple,
_props$bordered = props.bordered,
bordered = _props$bordered === void 0 ? true : _props$bordered,
onChange = props.onChange,
restProps = _objectWithoutProperties(props, _excluded);
var antdContext = useContext(ConfigProvider.ConfigContext);
var getOptions = useCallback(function () {
return options === null || options === void 0 ? void 0 : options.map(function (option) {
if (typeof option === 'string') {
return {
title: option,
value: option
};
}
return option;
});
}, [options]);
var prefixCls = antdContext.getPrefixCls('pro-checkcard', customizePrefixCls);
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var groupPrefixCls = "".concat(prefixCls, "-group");
var domProps = omit(restProps, ['children', 'defaultValue', 'value', 'disabled', 'size']);
var _useMountMergeState = useMountMergeState(props.defaultValue, {
value: props.value,
onChange: props.onChange
}),
_useMountMergeState2 = _slicedToArray(_useMountMergeState, 2),
stateValue = _useMountMergeState2[0],
setStateValue = _useMountMergeState2[1];
var registerValueMap = useRef(new Map());
var registerValue = function registerValue(value) {
var _registerValueMap$cur;
(_registerValueMap$cur = registerValueMap.current) === null || _registerValueMap$cur === void 0 || _registerValueMap$cur.set(value, true);
};
var cancelValue = function cancelValue(value) {
var _registerValueMap$cur2;
(_registerValueMap$cur2 = registerValueMap.current) === null || _registerValueMap$cur2 === void 0 || _registerValueMap$cur2.delete(value);
};
var toggleOption = function toggleOption(option) {
if (!multiple) {
var changeValue;
changeValue = stateValue;
// 单选模式
if (changeValue === option.value) {
changeValue = undefined;
} else {
changeValue = option.value;
}
setStateValue === null || setStateValue === void 0 || setStateValue(changeValue);
}
if (multiple) {
var _changeValue2;
var _changeValue = [];
var stateValues = stateValue;
var hasOption = stateValues === null || stateValues === void 0 ? void 0 : stateValues.includes(option.value);
_changeValue = _toConsumableArray(stateValues || []);
if (!hasOption) {
_changeValue.push(option.value);
}
if (hasOption) {
_changeValue = _changeValue.filter(function (itemValue) {
return itemValue !== option.value;
});
}
var newOptions = getOptions();
var newValue = (_changeValue2 = _changeValue) === null || _changeValue2 === void 0 || (_changeValue2 = _changeValue2.filter(function (val) {
return registerValueMap.current.has(val);
})) === null || _changeValue2 === void 0 ? void 0 : _changeValue2.sort(function (a, b) {
var indexA = newOptions.findIndex(function (opt) {
return opt.value === a;
});
var indexB = newOptions.findIndex(function (opt) {
return opt.value === b;
});
return indexA - indexB;
});
setStateValue(newValue);
}
};
var children = useMemo(function () {
if (loading) {
return new Array(options.length || React.Children.toArray(props.children).length || 1).fill(0)
// eslint-disable-next-line react/no-array-index-key
.map(function (_, index) {
return /*#__PURE__*/_jsx(CheckCard, {
loading: true
}, index);
});
}
if (options && options.length > 0) {
var optionValue = stateValue;
var renderOptions = function renderOptions(list) {
return list.map(function (option) {
var _option$size;
if (option.children && option.children.length > 0) {
var _option$value, _option$title;
return /*#__PURE__*/_jsx(SubCheckCardGroup, {
title: option.title,
prefix: groupPrefixCls,
children: renderOptions(option.children)
}, ((_option$value = option.value) === null || _option$value === void 0 ? void 0 : _option$value.toString()) || ((_option$title = option.title) === null || _option$title === void 0 ? void 0 : _option$title.toString()));
}
return /*#__PURE__*/_jsx(CheckCard, {
disabled: option.disabled,
size: (_option$size = option.size) !== null && _option$size !== void 0 ? _option$size : props.size,
value: option.value,
checked: multiple ? optionValue === null || optionValue === void 0 ? void 0 : optionValue.includes(option.value) : optionValue === option.value,
onChange: option.onChange,
title: option.title,
avatar: option.avatar,
description: option.description,
cover: option.cover
}, option.value.toString());
});
};
return renderOptions(getOptions());
}
return props.children;
}, [getOptions, loading, multiple, options, props.children, props.size, stateValue]);
var classString = classNames(groupPrefixCls, className, hashId);
return wrapSSR( /*#__PURE__*/_jsx(CheckCardGroupConnext.Provider, {
value: {
toggleOption: toggleOption,
bordered: bordered,
value: stateValue,
disabled: props.disabled,
size: props.size,
loading: props.loading,
multiple: props.multiple,
// https://github.com/ant-design/ant-design/issues/16376
registerValue: registerValue,
cancelValue: cancelValue
},
children: /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
className: classString,
style: style
}, domProps), {}, {
children: children
}))
}));
};
export default (function (props) {
return /*#__PURE__*/_jsx(ProConfigProvider, {
needDeps: true,
children: /*#__PURE__*/_jsx(CheckCardGroup, _objectSpread({}, props))
});
});

View File

@@ -0,0 +1,159 @@
import type { MouseEventHandler } from 'react';
import React from 'react';
import type { CheckCardGroupProps } from './Group';
import CheckCardGroup from './Group';
/**
* Props for the CheckCard component.
*/
interface CheckCardProps {
/**
* Custom prefix class.
*
* @ignore
*/
prefixCls?: string;
/**
* Callback function for change event.
*
* @param checked - The checked state.
*/
onChange?: (checked: boolean) => void;
/**
* Callback function for click event.
*
* @param event - The click event.
*/
onClick?: (event: MouseEventHandler<HTMLDivElement> | undefined) => void;
/**
* Callback function for mouse enter event.
*
* @param event - The mouse enter event.
*/
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
/**
* Callback function for mouse leave event.
*
* @param event - The mouse leave event.
*/
onMouseLeave?: (event: MouseEventHandler<HTMLDivElement> | undefined) => void;
/**
* Whether the card is initially checked.
*
* @default false
* @title Default Checked
*/
defaultChecked?: boolean;
/**
* Whether the card is checked.
*
* @default false
* @title Checked
*/
checked?: boolean;
/**
* Whether the card is disabled.
*
* @default false
* @title Disabled
*/
disabled?: boolean;
/**
* Custom style for the card.
*
* @ignore
*/
style?: React.CSSProperties;
/**
* Custom class name for the card.
*
* @ignore
*/
className?: string;
/**
* The avatar to display on the left side, can be a link or a ReactNode.
*
* @title Avatar
*/
avatar?: React.ReactNode;
/**
* The title to display.
*
* @title Title
*/
title?: React.ReactNode;
/**
* The subtitle to display.
*
* @title Subtitle
*/
subTitle?: React.ReactNode;
/**
* The description to display.
*
* @title Description
*/
description?: React.ReactNode;
/**
* The value of the card.
*
* @title Value
*/
value?: any;
/**
* Whether the content is in loading state.
*
* @default false
* @title Loading
*/
loading?: boolean;
/**
* The cover image of the card. Other display values are ignored in this mode.
*
* @title Card Background Image
*/
cover?: React.ReactNode;
/**
* The size of the component. Supports 'large', 'default', and 'small' sizes. Users can also customize the width and height.
*
* @default default
* @title Checkbox Size
*/
size?: 'large' | 'default' | 'small';
/**
* Whether to show the border.
*
* @default true
* @title Show Border
*/
bordered?: boolean;
/**
* The action area in the top right corner of the card.
*
* @title Actions
*/
extra?: React.ReactNode;
/**
* The content of the card.
*/
children?: React.ReactNode;
/**
* Custom style for the content area.
*/
bodyStyle?: React.CSSProperties;
/**
* The action area in the bottom right corner.
*/
actions?: React.ReactNode[];
/**
* Whether the card is in ghost mode.
*/
ghost?: boolean;
}
export interface CheckCardState {
checked: boolean;
}
declare const CheckCard: React.FC<CheckCardProps> & {
Group: typeof CheckCardGroup;
};
export type { CheckCardGroupProps, CheckCardProps };
export default CheckCard;

View File

@@ -0,0 +1,178 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
var _excluded = ["prefixCls", "className", "avatar", "title", "description", "cover", "extra", "style"];
import { useMountMergeState } from '@ant-design/pro-utils';
import { Avatar, ConfigProvider } from 'antd';
import classNames from 'classnames';
import React, { useContext, useEffect, useMemo } from 'react';
import ProCardActions from "../Actions";
import CheckCardGroup, { CardLoading, CheckCardGroupConnext } from "./Group";
import { useStyle } from "./style";
/**
* Props for the CheckCard component.
*/
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var CheckCard = function CheckCard(props) {
var _useMountMergeState = useMountMergeState(props.defaultChecked || false, {
value: props.checked,
onChange: props.onChange
}),
_useMountMergeState2 = _slicedToArray(_useMountMergeState, 2),
stateChecked = _useMountMergeState2[0],
setStateChecked = _useMountMergeState2[1];
var checkCardGroup = useContext(CheckCardGroupConnext);
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var handleClick = function handleClick(e) {
var _props$onClick, _checkCardGroup$toggl;
props === null || props === void 0 || (_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, e);
var newChecked = !stateChecked;
checkCardGroup === null || checkCardGroup === void 0 || (_checkCardGroup$toggl = checkCardGroup.toggleOption) === null || _checkCardGroup$toggl === void 0 || _checkCardGroup$toggl.call(checkCardGroup, {
value: props.value
});
setStateChecked === null || setStateChecked === void 0 || setStateChecked(newChecked);
};
// small => sm large => lg
var getSizeCls = function getSizeCls(size) {
if (size === 'large') return 'lg';
if (size === 'small') return 'sm';
return '';
};
useEffect(function () {
var _checkCardGroup$regis;
checkCardGroup === null || checkCardGroup === void 0 || (_checkCardGroup$regis = checkCardGroup.registerValue) === null || _checkCardGroup$regis === void 0 || _checkCardGroup$regis.call(checkCardGroup, props.value);
return function () {
var _checkCardGroup$cance;
return checkCardGroup === null || checkCardGroup === void 0 || (_checkCardGroup$cance = checkCardGroup.cancelValue) === null || _checkCardGroup$cance === void 0 ? void 0 : _checkCardGroup$cance.call(checkCardGroup, props.value);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.value]);
var customizePrefixCls = props.prefixCls,
className = props.className,
avatar = props.avatar,
title = props.title,
description = props.description,
cover = props.cover,
extra = props.extra,
_props$style = props.style,
style = _props$style === void 0 ? {} : _props$style,
others = _objectWithoutProperties(props, _excluded);
var checkCardProps = _objectSpread({}, others);
var prefixCls = getPrefixCls('pro-checkcard', customizePrefixCls);
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
/**
* 头像自定义
*
* @param cls
* @param coverDom
* @returns
*/
var renderCover = function renderCover(cls, coverDom) {
return /*#__PURE__*/_jsx("div", {
className: classNames("".concat(cls, "-cover"), hashId),
children: typeof coverDom === 'string' ? /*#__PURE__*/_jsx("img", {
src: coverDom,
alt: "checkcard"
}) : coverDom
});
};
checkCardProps.checked = stateChecked;
var multiple = false;
if (checkCardGroup) {
var _checkCardGroup$value;
// 受组控制模式
checkCardProps.disabled = props.disabled || checkCardGroup.disabled;
checkCardProps.loading = props.loading || checkCardGroup.loading;
checkCardProps.bordered = props.bordered || checkCardGroup.bordered;
multiple = checkCardGroup.multiple;
var isChecked = checkCardGroup.multiple ? (_checkCardGroup$value = checkCardGroup.value) === null || _checkCardGroup$value === void 0 ? void 0 : _checkCardGroup$value.includes(props.value) : checkCardGroup.value === props.value;
// loading时check为false
checkCardProps.checked = checkCardProps.loading ? false : isChecked;
checkCardProps.size = props.size || checkCardGroup.size;
}
var _checkCardProps$disab = checkCardProps.disabled,
disabled = _checkCardProps$disab === void 0 ? false : _checkCardProps$disab,
size = checkCardProps.size,
cardLoading = checkCardProps.loading,
_checkCardProps$borde = checkCardProps.bordered,
bordered = _checkCardProps$borde === void 0 ? true : _checkCardProps$borde,
checked = checkCardProps.checked;
var sizeCls = getSizeCls(size);
var classString = classNames(prefixCls, className, hashId, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-loading"), cardLoading), "".concat(prefixCls, "-").concat(sizeCls), sizeCls), "".concat(prefixCls, "-checked"), checked), "".concat(prefixCls, "-multiple"), multiple), "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-bordered"), bordered), "".concat(prefixCls, "-ghost"), props.ghost));
var metaDom = useMemo(function () {
if (cardLoading) {
return /*#__PURE__*/_jsx(CardLoading, {
prefixCls: prefixCls || '',
hashId: hashId
});
}
if (cover) {
return renderCover(prefixCls || '', cover);
}
var avatarDom = avatar ? /*#__PURE__*/_jsx("div", {
className: classNames("".concat(prefixCls, "-avatar"), hashId),
children: typeof avatar === 'string' ? /*#__PURE__*/_jsx(Avatar, {
size: 48,
shape: "square",
src: avatar
}) : avatar
}) : null;
var headerDom = (title !== null && title !== void 0 ? title : extra) != null && /*#__PURE__*/_jsxs("div", {
className: classNames("".concat(prefixCls, "-header"), hashId),
children: [/*#__PURE__*/_jsxs("div", {
className: classNames("".concat(prefixCls, "-header-left"), hashId),
children: [/*#__PURE__*/_jsx("div", {
className: classNames("".concat(prefixCls, "-title"), hashId, _defineProperty({}, "".concat(prefixCls, "-title-with-ellipsis"), typeof title === 'string')),
children: title
}), props.subTitle ? /*#__PURE__*/_jsx("div", {
className: classNames("".concat(prefixCls, "-subTitle"), hashId),
children: props.subTitle
}) : null]
}), extra && /*#__PURE__*/_jsx("div", {
className: classNames("".concat(prefixCls, "-extra"), hashId),
children: extra
})]
});
var descriptionDom = description ? /*#__PURE__*/_jsx("div", {
className: classNames("".concat(prefixCls, "-description"), hashId),
children: description
}) : null;
var metaClass = classNames("".concat(prefixCls, "-content"), hashId, _defineProperty({}, "".concat(prefixCls, "-avatar-header"), avatarDom && headerDom && !descriptionDom));
return /*#__PURE__*/_jsxs("div", {
className: metaClass,
children: [avatarDom, headerDom || descriptionDom ? /*#__PURE__*/_jsxs("div", {
className: classNames("".concat(prefixCls, "-detail"), hashId),
children: [headerDom, descriptionDom]
}) : null]
});
}, [avatar, cardLoading, cover, description, extra, hashId, prefixCls, props.subTitle, title]);
return wrapSSR( /*#__PURE__*/_jsxs("div", {
className: classString,
style: style,
onClick: function onClick(e) {
if (!cardLoading && !disabled) {
handleClick(e);
}
},
onMouseEnter: props.onMouseEnter,
children: [metaDom, props.children ? /*#__PURE__*/_jsx("div", {
className: classNames("".concat(prefixCls, "-body"), hashId),
style: props.bodyStyle,
children: props.children
}) : null, props.actions ? /*#__PURE__*/_jsx(ProCardActions, {
actions: props.actions,
prefixCls: prefixCls
}) : null]
}));
};
CheckCard.Group = CheckCardGroup;
export default CheckCard;

View File

@@ -0,0 +1,11 @@
/// <reference types="react" />
import { Keyframes } from '@ant-design/cssinjs';
import type { ProAliasToken } from '@ant-design/pro-provider';
export interface ProListToken extends ProAliasToken {
componentCls: string;
}
export declare const cardLoading: Keyframes;
export declare function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,200 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Keyframes } from '@ant-design/cssinjs';
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
var proCheckCardActive = function proCheckCardActive(token) {
return {
backgroundColor: token.colorPrimaryBg,
borderColor: token.colorPrimary
};
};
var proCheckCardDisabled = function proCheckCardDisabled(token) {
return _defineProperty({
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
cursor: 'not-allowed'
}, token.componentCls, {
'&-description': {
color: token.colorTextDisabled
},
'&-title': {
color: token.colorTextDisabled
},
'&-avatar': {
opacity: '0.25'
}
});
};
export var cardLoading = new Keyframes('card-loading', {
'0%': {
backgroundPosition: '0 50%'
},
'50%': {
backgroundPosition: '100% 50%'
},
'100%': {
backgroundPosition: '0 50%'
}
});
var genProStyle = function genProStyle(token) {
var _token$componentCls;
return _defineProperty({}, token.componentCls, (_token$componentCls = {
position: 'relative',
display: 'inline-block',
width: '320px',
marginInlineEnd: '16px',
marginBlockEnd: '16px',
color: token.colorText,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
verticalAlign: 'top',
backgroundColor: token.colorBgContainer,
borderRadius: token.borderRadius,
overflow: 'auto',
cursor: 'pointer',
transition: "all 0.3s",
'&:after': {
position: 'absolute',
insetBlockStart: 2,
insetInlineEnd: 2,
width: 0,
height: 0,
opacity: 0,
transition: 'all 0.3s ' + token.motionEaseInOut,
borderBlockEnd: "".concat(token.borderRadius + 4, "px solid transparent"),
borderInlineStart: "".concat(token.borderRadius + 4, "px solid transparent"),
borderStartEndRadius: "".concat(token.borderRadius, "px"),
content: "''"
},
'&:last-child': {
marginInlineEnd: 0
},
'& + &': {
marginInlineStart: '0 !important'
},
'&-bordered': {
border: "".concat(token.lineWidth, "px solid ").concat(token.colorBorder)
},
'&-group': {
display: 'inline-block',
'&-sub-check-card': {
display: 'flex',
flexDirection: 'column',
gap: '8px',
'&-title': {
cursor: 'pointer',
paddingBlock: token.paddingXS,
display: 'flex',
gap: 4,
alignItems: 'center'
},
'&-panel': {
visibility: 'initial',
transition: 'all 0.3s',
opacity: 1,
'&-collapse': {
display: 'none',
visibility: 'hidden',
opacity: 0
}
}
}
}
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_token$componentCls, "".concat(token.componentCls, "-loading"), {
overflow: 'hidden',
userSelect: 'none',
'&-content': {
padding: token.paddingMD
}
}), '&:focus', proCheckCardActive(token)), '&-checked', _objectSpread(_objectSpread({}, proCheckCardActive(token)), {}, {
'&:after': {
opacity: 1,
border: "".concat(token.borderRadius + 4, "px solid ").concat(token.colorPrimary),
borderBlockEnd: "".concat(token.borderRadius + 4, "px solid transparent"),
borderInlineStart: "".concat(token.borderRadius + 4, "px solid transparent"),
borderStartEndRadius: "".concat(token.borderRadius, "px")
}
})), '&-disabled', proCheckCardDisabled(token)), '&[disabled]', proCheckCardDisabled(token)), '&-checked&-disabled', {
'&:after': {
position: 'absolute',
insetBlockStart: 2,
insetInlineEnd: 2,
width: 0,
height: 0,
border: "".concat(token.borderRadius + 4, "px solid ").concat(token.colorTextDisabled),
borderBlockEnd: "".concat(token.borderRadius + 4, "px solid transparent"),
borderInlineStart: "".concat(token.borderRadius + 4, "px solid transparent"),
borderStartEndRadius: "".concat(token.borderRadius, "px"),
content: "''"
}
}), '&-lg', {
width: 440
}), '&-sm', {
width: 212
}), '&-cover', {
paddingInline: token.paddingXXS,
paddingBlock: token.paddingXXS,
img: {
width: '100%',
height: '100%',
overflow: 'hidden',
borderRadius: token.borderRadius
}
}), '&-content', {
display: 'flex',
paddingInline: token.paddingSM,
paddingBlock: token.padding
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_token$componentCls, '&-body', {
paddingInline: token.paddingSM,
paddingBlock: token.padding
}), '&-avatar-header', {
display: 'flex',
alignItems: 'center'
}), '&-avatar', {
paddingInlineEnd: 8
}), '&-detail', {
overflow: 'hidden',
width: '100%',
'> div:not(:last-child)': {
marginBlockEnd: 4
}
}), '&-header', {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
lineHeight: token.lineHeight,
'&-left': {
display: 'flex',
alignItems: 'center',
gap: token.sizeSM,
minWidth: 0
}
}), '&-title', {
overflow: 'hidden',
color: token.colorTextHeading,
fontWeight: '500',
fontSize: token.fontSize,
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
'&-with-ellipsis': {
display: 'inline-block'
}
}), '&-description', {
color: token.colorTextSecondary
}), "&:not(".concat(token.componentCls, "-disabled)"), {
'&:hover': {
borderColor: token.colorPrimary
}
})));
};
export function useStyle(prefixCls) {
return useAntdStyle('CheckCard', function (token) {
var proListToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proListToken)];
});
}

View File

@@ -0,0 +1,23 @@
import React from 'react';
export type ProCardDividerProps = {
/**
* 样式
*
* @ignore
*/
style?: React.CSSProperties;
/**
* ClassName
*
* @ignore
*/
className?: string;
/**
* 布局类型
*
* @default vertical
*/
type?: 'horizontal' | 'vertical';
};
declare const ProCardDivider: React.FC<ProCardDividerProps>;
export default ProCardDivider;

View File

@@ -0,0 +1,25 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { ConfigProvider } from 'antd';
import classNames from 'classnames';
import React, { useContext } from 'react';
import useStyle from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
var ProCardDivider = function ProCardDivider(props) {
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var proCardPrefixCls = getPrefixCls('pro-card');
var prefixCls = "".concat(proCardPrefixCls, "-divider");
var _useStyle = useStyle(proCardPrefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var className = props.className,
_props$style = props.style,
style = _props$style === void 0 ? {} : _props$style,
type = props.type;
var classString = classNames(prefixCls, className, hashId, _defineProperty({}, "".concat(prefixCls, "-").concat(type), type));
return wrapSSR( /*#__PURE__*/_jsx("div", {
className: classString,
style: style
}));
};
export default ProCardDivider;

View File

@@ -0,0 +1,5 @@
/// <reference types="react" />
export default function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,37 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
var genDividerStyle = function genDividerStyle(token) {
var componentCls = token.componentCls;
return _defineProperty({}, componentCls, {
'&-divider': {
flex: 'none',
width: token.lineWidth,
marginInline: token.marginXS,
marginBlock: token.marginLG,
backgroundColor: token.colorSplit,
'&-horizontal': {
width: 'initial',
height: token.lineWidth,
marginInline: token.marginLG,
marginBlock: token.marginXS
}
},
'&&-size-small &-divider': {
marginBlock: token.marginLG,
marginInline: token.marginXS,
'&-horizontal': {
marginBlock: token.marginXS,
marginInline: token.marginLG
}
}
});
};
export default function useStyle(prefixCls) {
return useAntdStyle('ProCardDivider', function (token) {
var proCardDividerToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genDividerStyle(proCardDividerToken)];
});
}

View File

@@ -0,0 +1,11 @@
import React from 'react';
type LoadingProps = {
/** 类名 */
className?: string;
/** 样式属性 */
style?: React.CSSProperties;
/** Prefix */
prefix?: string;
};
declare const Loading: React.FC<LoadingProps>;
export default Loading;

View File

@@ -0,0 +1,82 @@
import { Col, Row } from 'antd';
import React from 'react';
import { useStyle } from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var Loading = function Loading(props) {
var style = props.style,
prefix = props.prefix;
var _useStyle = useStyle(prefix || 'ant-pro-card'),
wrapSSR = _useStyle.wrapSSR;
return wrapSSR( /*#__PURE__*/_jsxs("div", {
className: "".concat(prefix, "-loading-content"),
style: style,
children: [/*#__PURE__*/_jsx(Row, {
gutter: 8,
children: /*#__PURE__*/_jsx(Col, {
span: 22,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
})
}), /*#__PURE__*/_jsxs(Row, {
gutter: 8,
children: [/*#__PURE__*/_jsx(Col, {
span: 8,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
}), /*#__PURE__*/_jsx(Col, {
span: 15,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
})]
}), /*#__PURE__*/_jsxs(Row, {
gutter: 8,
children: [/*#__PURE__*/_jsx(Col, {
span: 6,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
}), /*#__PURE__*/_jsx(Col, {
span: 18,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
})]
}), /*#__PURE__*/_jsxs(Row, {
gutter: 8,
children: [/*#__PURE__*/_jsx(Col, {
span: 13,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
}), /*#__PURE__*/_jsx(Col, {
span: 9,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
})]
}), /*#__PURE__*/_jsxs(Row, {
gutter: 8,
children: [/*#__PURE__*/_jsx(Col, {
span: 4,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
}), /*#__PURE__*/_jsx(Col, {
span: 3,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
}), /*#__PURE__*/_jsx(Col, {
span: 16,
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefix, "-loading-block")
})
})]
})]
}));
};
export default Loading;

View File

@@ -0,0 +1,11 @@
/// <reference types="react" />
import { Keyframes } from '@ant-design/cssinjs';
import type { ProAliasToken } from '@ant-design/pro-provider';
export interface ProToken extends ProAliasToken {
componentCls: string;
}
export declare const cardLoading: Keyframes;
export declare function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,49 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Keyframes } from '@ant-design/cssinjs';
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
export var cardLoading = new Keyframes('card-loading', {
'0%': {
backgroundPosition: '0 50%'
},
'50%': {
backgroundPosition: '100% 50%'
},
'100%': {
backgroundPosition: '0 50%'
}
});
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, _defineProperty(_defineProperty({
'&-loading': {
overflow: 'hidden'
},
'&-loading &-body': {
userSelect: 'none'
}
}, "".concat(token.componentCls, "-loading-content"), {
width: '100%',
p: {
marginBlock: 0,
marginInline: 0
}
}), "".concat(token.componentCls, "-loading-block"), {
height: '14px',
marginBlock: '4px',
background: "linear-gradient(90deg, rgba(54, 61, 64, 0.2), rgba(54, 61, 64, 0.4), rgba(54, 61, 64, 0.2))",
backgroundSize: '600% 600%',
borderRadius: token.borderRadius,
animationName: cardLoading,
animationDuration: '1.4s',
animationTimingFunction: 'ease',
animationIterationCount: 'infinite'
}));
};
export function useStyle(prefixCls) {
return useAntdStyle('ProCardLoading', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}

View File

@@ -0,0 +1,18 @@
import React from 'react';
export interface ProCardOperationProps {
/**
* 样式
*
* @ignore
*/
style?: React.CSSProperties;
/**
* ClassName
*
* @ignore
*/
className?: string;
children?: any;
}
declare const ProCardOperation: React.FC<ProCardOperationProps>;
export default ProCardOperation;

View File

@@ -0,0 +1,24 @@
import { ConfigProvider } from 'antd';
import classNames from 'classnames';
import React, { useContext } from 'react';
import { useStyle } from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
var ProCardOperation = function ProCardOperation(props) {
var className = props.className,
_props$style = props.style,
style = _props$style === void 0 ? {} : _props$style,
children = props.children;
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var prefixCls = getPrefixCls('pro-card-operation');
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var classString = classNames(prefixCls, className, hashId);
return wrapSSR( /*#__PURE__*/_jsx("div", {
className: classString,
style: style,
children: children
}));
};
export default ProCardOperation;

View File

@@ -0,0 +1,9 @@
/// <reference types="react" />
import type { ProAliasToken } from '@ant-design/pro-provider';
export interface ProToken extends ProAliasToken {
componentCls: string;
}
export declare function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,24 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, {
display: 'flex',
flexDirection: 'column',
justifyContent: 'flex-end',
marginBlock: token.marginLG,
marginInline: 0,
color: token.colorText,
fontWeight: '500',
fontSize: '20px',
lineHeight: '38px'
});
};
export function useStyle(prefixCls) {
return useAntdStyle('ProCardOperation', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}

View File

@@ -0,0 +1,31 @@
import type { StatisticProps as AntdStatisticProps, BadgeProps } from 'antd';
import React from 'react';
export interface StatisticProps extends AntdStatisticProps {
/**
* 样式
*
* @ignore
*/
style?: React.CSSProperties;
/**
* ClassName
*
* @ignore
*/
className?: string;
/** 描述性标签 */
description?: React.ReactNode;
/** 标题提示 */
tip?: React.ReactNode;
/** 当前项显示的状态 */
status?: BadgeProps['status'];
/** Icon 图标 */
icon?: React.ReactNode;
/** Layout 布局 */
layout?: 'horizontal' | 'vertical' | 'inline';
/** 趋势 */
trend?: 'up' | 'down';
children?: any;
}
declare const Statistic: React.FC<StatisticProps>;
export default Statistic;

View File

@@ -0,0 +1,83 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["className", "layout", "style", "description", "children", "title", "tip", "status", "trend", "prefix", "icon"];
import { QuestionCircleOutlined } from '@ant-design/icons';
import { Statistic as AntdStatistic, Badge, ConfigProvider, Tooltip } from 'antd';
import classNames from 'classnames';
import React, { useContext } from 'react';
import { useStyle } from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var Statistic = function Statistic(props) {
var className = props.className,
_props$layout = props.layout,
layout = _props$layout === void 0 ? 'inline' : _props$layout,
style = props.style,
description = props.description,
children = props.children,
title = props.title,
tip = props.tip,
status = props.status,
trend = props.trend,
prefix = props.prefix,
icon = props.icon,
others = _objectWithoutProperties(props, _excluded);
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var prefixCls = getPrefixCls('pro-card-statistic');
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var classString = classNames(prefixCls, className, hashId);
var statusClass = classNames("".concat(prefixCls, "-status"), hashId);
var iconClass = classNames("".concat(prefixCls, "-icon"), hashId);
var wrapperClass = classNames("".concat(prefixCls, "-wrapper"), hashId);
var contentClass = classNames("".concat(prefixCls, "-content"), hashId);
var statisticClassName = classNames(hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-layout-").concat(layout), layout), "".concat(prefixCls, "-trend-").concat(trend), trend));
var tipDom = tip && /*#__PURE__*/_jsx(Tooltip, {
title: tip,
children: /*#__PURE__*/_jsx(QuestionCircleOutlined, {
className: "".concat(prefixCls, "-tip ").concat(hashId).trim()
})
});
var trendIconClassName = classNames("".concat(prefixCls, "-trend-icon"), hashId, _defineProperty({}, "".concat(prefixCls, "-trend-icon-").concat(trend), trend));
var trendDom = trend && /*#__PURE__*/_jsx("div", {
className: trendIconClassName
});
var statusDom = status && /*#__PURE__*/_jsx("div", {
className: statusClass,
children: /*#__PURE__*/_jsx(Badge, {
status: status,
text: null
})
});
var iconDom = icon && /*#__PURE__*/_jsx("div", {
className: iconClass,
children: icon
});
return wrapSSR( /*#__PURE__*/_jsxs("div", {
className: classString,
style: style,
children: [iconDom, /*#__PURE__*/_jsxs("div", {
className: wrapperClass,
children: [statusDom, /*#__PURE__*/_jsxs("div", {
className: contentClass,
children: [/*#__PURE__*/_jsx(AntdStatistic, _objectSpread({
title: (title || tipDom) && /*#__PURE__*/_jsxs(_Fragment, {
children: [title, tipDom]
}),
prefix: (trendDom || prefix) && /*#__PURE__*/_jsxs(_Fragment, {
children: [trendDom, prefix]
}),
className: statisticClassName
}, others)), description && /*#__PURE__*/_jsx("div", {
className: "".concat(prefixCls, "-description ").concat(hashId).trim(),
children: description
})]
})]
})]
}));
};
export default Statistic;

View File

@@ -0,0 +1,9 @@
/// <reference types="react" />
import type { ProAliasToken } from '@ant-design/pro-provider';
export interface ProListToken extends ProAliasToken {
componentCls: string;
}
export declare function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,84 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
display: 'flex',
fontSize: token.fontSize,
'& + &': {
marginBlockStart: 4
},
'&-tip': {
marginInlineStart: 4
},
'&-wrapper': _defineProperty({
display: 'flex',
width: '100%'
}, "".concat(token.componentCls, "-status"), {
width: '14px'
}),
'&-icon': {
marginInlineEnd: 16
},
'&-trend-icon': {
width: 0,
height: 0,
borderInlineEnd: '3.5px solid transparent',
borderBlockEnd: '9px solid #000',
borderInlineStart: '3.5px solid transparent',
'&-up': {
transform: 'rotate(0deg)'
},
'&-down': {
transform: 'rotate(180deg)'
}
},
'&-content': _defineProperty({
width: '100%'
}, "".concat(token.antCls, "-statistic-content"), {
'&-value-int': {
fontSize: token.fontSizeHeading3
}
}),
'&-description': {
width: '100%'
}
}, "".concat(token.antCls, "-statistic-title"), {
color: token.colorText
}), '&-trend-up', _defineProperty({}, "".concat(token.antCls, "-statistic-content"), _defineProperty({
color: '#f5222d'
}, "".concat(token.componentCls, "-trend-icon"), {
borderBlockEndColor: '#f5222d'
}))), '&-trend-down', _defineProperty({}, "".concat(token.antCls, "-statistic-content"), _defineProperty({
color: '#389e0d'
}, "".concat(token.componentCls, "-trend-icon"), {
borderBlockEndColor: '#52c41a'
}))), '& &-layout-horizontal', _defineProperty(_defineProperty(_defineProperty({
display: 'flex',
justifyContent: 'space-between'
}, "".concat(token.antCls, "-statistic-title"), {
marginBlockEnd: 0
}), "".concat(token.antCls, "-statistic-content-value"), {
fontWeight: 500
}), "".concat(token.antCls, "-statistic-title,").concat(token.antCls, "-statistic-content,").concat(token.antCls, "-statistic-content-suffix,").concat(token.antCls, "-statistic-content-prefix,").concat(token.antCls, "-statistic-content-value-decimal"), {
fontSize: token.fontSize
})), '& &-layout-inline', _defineProperty(_defineProperty(_defineProperty({
display: 'inline-flex',
color: token.colorTextSecondary
}, "".concat(token.antCls, "-statistic-title"), {
marginInlineEnd: '6px',
marginBlockEnd: 0
}), "".concat(token.antCls, "-statistic-content"), {
color: token.colorTextSecondary
}), "".concat(token.antCls, "-statistic-title,").concat(token.antCls, "-statistic-content,").concat(token.antCls, "-statistic-content-suffix,").concat(token.antCls, "-statistic-content-prefix,").concat(token.antCls, "-statistic-content-value-decimal"), {
fontSize: token.fontSizeSM
})));
};
export function useStyle(prefixCls) {
return useAntdStyle('Statistic', function (token) {
var proListToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proListToken)];
});
}

View File

@@ -0,0 +1,29 @@
import React from 'react';
import type { CardProps } from '../../typing';
import Divider from '../Divider';
import Operation from '../Operation';
import type { StatisticProps } from '../Statistic';
import Statistic from '../Statistic';
import 'antd/lib/divider/style';
import 'antd/lib/statistic/style';
export type StatisticCardProps = {
/** 图表配置 */
chart?: React.ReactNode;
/** 数值统计配置 */
statistic?: StatisticProps;
/** Chart 相对于 statistic 的位置 */
chartPlacement?: 'right' | 'bottom' | 'left';
/** 底部额外展示区域 */
footer?: React.ReactNode;
} & CardProps;
/** @deprecated */
export type StatisticsCardProps = StatisticCardProps;
declare const StatisticCard: React.FC<StatisticCardProps> & {
Statistic: typeof Statistic;
Divider: typeof Divider;
Operation: typeof Operation;
isProCard: boolean;
Group: typeof Group;
};
declare const Group: React.FC<StatisticCardProps>;
export default StatisticCard;

View File

@@ -0,0 +1,76 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["children", "statistic", "className", "chart", "chartPlacement", "footer"];
import { ConfigProvider } from 'antd';
import classNames from 'classnames';
import React, { useContext } from 'react';
import Card from "../Card";
import Divider from "../Divider";
import Operation from "../Operation";
import Statistic from "../Statistic";
import { useStyle } from "./style";
import "antd/es/divider/style";
import "antd/es/statistic/style";
/** @deprecated */
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var StatisticCard = function StatisticCard(props) {
var children = props.children,
statistic = props.statistic,
className = props.className,
chart = props.chart,
chartPlacement = props.chartPlacement,
footer = props.footer,
others = _objectWithoutProperties(props, _excluded);
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var prefixCls = getPrefixCls('pro-statistic-card');
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var classString = classNames(prefixCls, className, hashId);
// 在 StatisticCard 中时默认为 vertical。
var statisticDom = statistic && /*#__PURE__*/_jsx(Statistic, _objectSpread({
layout: "vertical"
}, statistic));
var chartCls = classNames("".concat(prefixCls, "-chart"), hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-chart-left"), chartPlacement === 'left' && chart && statistic), "".concat(prefixCls, "-chart-right"), chartPlacement === 'right' && chart && statistic));
var chartDom = chart && /*#__PURE__*/_jsx("div", {
className: chartCls,
children: chart
});
var contentCls = classNames("".concat(prefixCls, "-content "), hashId, _defineProperty({}, "".concat(prefixCls, "-content-horizontal"), chartPlacement === 'left' || chartPlacement === 'right'));
// 默认上下结构
var contentDom = (chartDom || statisticDom) && (chartPlacement === 'left' ? /*#__PURE__*/_jsxs("div", {
className: contentCls,
children: [chartDom, statisticDom]
}) : /*#__PURE__*/_jsxs("div", {
className: contentCls,
children: [statisticDom, chartDom]
}));
var footerDom = footer && /*#__PURE__*/_jsx("div", {
className: "".concat(prefixCls, "-footer ").concat(hashId).trim(),
children: footer
});
return wrapSSR( /*#__PURE__*/_jsxs(Card, _objectSpread(_objectSpread({
className: classString
}, others), {}, {
children: [contentDom, children, footerDom]
})));
};
var Group = function Group(props) {
return /*#__PURE__*/_jsx(StatisticCard, _objectSpread({
bodyStyle: {
padding: 0
}
}, props));
};
StatisticCard.Statistic = Statistic;
StatisticCard.Divider = Divider;
StatisticCard.Operation = Operation;
StatisticCard.isProCard = true;
StatisticCard.Group = Group;
export default StatisticCard;

View File

@@ -0,0 +1,9 @@
/// <reference types="react" />
import type { ProAliasToken } from '@ant-design/pro-provider';
export interface ProListToken extends ProAliasToken {
componentCls: string;
}
export declare function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,44 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, {
'&-chart': {
display: 'flex',
flexDirection: 'column',
marginBlockStart: 8,
marginBlockEnd: 8,
'&-left': {
marginBlockStart: 0,
marginInlineEnd: '16px'
},
'&-right': {
marginBlockStart: 0,
marginInlineStart: '16px'
}
},
'&-content': {
display: 'flex',
flexDirection: 'column',
'&-horizontal': _defineProperty({
flexDirection: 'row'
}, "".concat(token.componentCls, "-chart"), {
alignItems: 'center',
alignSelf: 'flex-start'
})
},
'&-footer': {
marginBlockStart: 8,
paddingBlockStart: '16px',
borderBlockStart: "rgba(0, 0, 0, 0.08) solid ".concat(token.colorBorder)
}
});
};
export function useStyle(prefixCls) {
return useAntdStyle('StatisticCard', function (token) {
var proListToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proListToken)];
});
}

View File

@@ -0,0 +1,26 @@
import type { TabsProps } from 'antd';
import React from 'react';
import type { ProCardTabPaneProps, ProCardTabsProps } from '../../typing';
export declare function useLegacyItems(items?: TabsProps['items'], children?: React.ReactNode, tabs?: ProCardTabsProps): {
children: import("react/jsx-runtime").JSX.Element;
label: React.ReactNode;
className?: string;
style?: React.CSSProperties;
disabled?: boolean;
forceRender?: boolean;
closable?: boolean;
closeIcon?: React.ReactNode;
icon?: React.ReactNode;
prefixCls?: string;
tabKey?: string;
id?: string;
animated?: boolean;
active?: boolean;
destroyInactiveTabPane?: boolean;
key: string;
}[];
/**
* @deprecated ProComponets 3.0
*/
declare const TabPane: React.FC<ProCardTabPaneProps>;
export default TabPane;

View File

@@ -0,0 +1,90 @@
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
var _excluded = ["tab", "children"],
_excluded2 = ["key", "tab", "tabKey", "disabled", "destroyInactiveTabPane", "children", "className", "style", "cardProps"];
import { ConfigProvider, Tabs, version } from 'antd';
import classNames from 'classnames';
import toArray from "rc-util/es/Children/toArray";
import { noteOnce } from "rc-util/es/warning";
import React, { useContext } from 'react';
import Card from "../Card";
import { jsx as _jsx } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
function filter(items) {
return items.filter(function (item) {
return item;
});
}
export function useLegacyItems(items, children, tabs) {
if (items) {
return items.map(function (item) {
return _objectSpread(_objectSpread({}, item), {}, {
children: /*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({}, tabs === null || tabs === void 0 ? void 0 : tabs.cardProps), {}, {
children: item.children
}))
});
});
}
noteOnce(!tabs, 'Tabs.TabPane is deprecated. Please use `items` directly.');
var childrenItems = toArray(children).map(function (node) {
if ( /*#__PURE__*/React.isValidElement(node)) {
var key = node.key,
props = node.props;
var _ref = props || {},
tab = _ref.tab,
tempChild = _ref.children,
restProps = _objectWithoutProperties(_ref, _excluded);
var item = _objectSpread(_objectSpread({
key: String(key)
}, restProps), {}, {
children: /*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({}, tabs === null || tabs === void 0 ? void 0 : tabs.cardProps), {}, {
children: tempChild
})),
label: tab
});
return item;
}
return null;
});
return filter(childrenItems);
}
/**
* @deprecated ProComponets 3.0
*/
var TabPane = function TabPane(props) {
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
// 如果是antd v5 则返回为空
if (version.startsWith('5')) {
return /*#__PURE__*/_jsx(_Fragment, {});
} else {
var key = props.key,
tab = props.tab,
tabKey = props.tabKey,
disabled = props.disabled,
destroyInactiveTabPane = props.destroyInactiveTabPane,
children = props.children,
className = props.className,
style = props.style,
cardProps = props.cardProps,
rest = _objectWithoutProperties(props, _excluded2);
var prefixCls = getPrefixCls('pro-card-tabpane');
var tabPaneClassName = classNames(prefixCls, className);
return /*#__PURE__*/_jsx(Tabs.TabPane, _objectSpread(_objectSpread({
tabKey: tabKey,
tab: tab,
className: tabPaneClassName,
style: style,
disabled: disabled,
destroyInactiveTabPane: destroyInactiveTabPane
}, rest), {}, {
children: /*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({}, cardProps), {}, {
children: children
}))
}), key);
}
};
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {
TabPane.displayName = 'DeprecatedTabPane';
}
export default TabPane;