@flatbiz/antd
Version:
101 lines (96 loc) • 3.53 kB
JavaScript
/*! @flatjs/forge MIT @flatbiz/antd */
import { isArray } from '@dimjs/lang/is-array';
import { b as _objectSpread2 } from './_rollupPluginBabelHelpers-BYm17lo8.js';
import { extend } from '@dimjs/utils/extend/extend';
import { classNames } from '@dimjs/utils/class-names/class-names';
import { Fragment } from 'react';
import { Space } from 'antd';
import { B as BlockLayout } from './layout-OPf8eBBY.js';
import { jsx, jsxs } from 'react/jsx-runtime';
/**
* 卡片结构布局,替代 SimpleLayout 组件
* @param props
* @returns
* ```
* 1. layoutType 布局类型
* layer:分层布局
* tight:紧凑布局(没有外边距)
* ```
*/
var CardLayout = function CardLayout(props) {
var _props$style;
var className = classNames('card-layout', {
'card-layout-tight': props.layoutType === 'tight',
// 'card-layout-formlabel-left': labelAlign === 'left',
'card-layout-title-fixed': props.titleFixed,
'card-layout-small': props.size === 'small'
}, props.className);
// const theme = fbaHooks.useThemeToken();
var style = extend(
// { '--card-layout-colorPrimary': theme.colorPrimary },
props.style, {
padding: props.padding,
width: props.width,
height: props.height,
overflowY: !props.titleFixed && (props.height || (_props$style = props.style) !== null && _props$style !== void 0 && _props$style.height) ? 'auto' : undefined
});
if (props.hidden) return /*#__PURE__*/jsx(Fragment, {});
return /*#__PURE__*/jsxs(BlockLayout, {
className: className,
style: style,
onClick: props.onClick,
children: [props.title || props.titleExtra ? /*#__PURE__*/jsxs("div", {
className: classNames('card-layout-title', {
'card-layout-title-sign': props.title ? props.titleLeftLine : false
}),
style: props.titleStyle,
children: [props.subTitle ? /*#__PURE__*/jsxs(Fragment, {
children: [/*#__PURE__*/jsx("div", {
className: "card-layout-title-content",
style: props.titleContentStyle,
children: props.title
}), /*#__PURE__*/jsx("div", {
className: "card-layout-subtitle",
style: _objectSpread2({
marginLeft: 10
}, props.subTitleStyle),
children: props.subTitle
})]
}) : /*#__PURE__*/jsx("div", {
className: "card-layout-title-content",
style: _objectSpread2({
flex: 1
}, props.titleContentStyle),
children: props.title
}), props.titleExtra ? /*#__PURE__*/jsx("div", {
className: "card-layout-title-extra",
style: props.titleExtraStyle,
children: props.titleExtra
}) : null]
}) : null, props.desc && !isArray(props.desc) ? /*#__PURE__*/jsx("div", {
className: "card-layout-desc",
children: props.desc
}) : null, props.desc && isArray(props.desc) ? /*#__PURE__*/jsx("div", {
className: "card-layout-desc-list",
children: /*#__PURE__*/jsx(Space, {
direction: "vertical",
size: 0,
children: props.desc.map(function (item, index) {
return /*#__PURE__*/jsx(Fragment, {
children: item
}, index);
})
})
}) : null, props.children ? /*#__PURE__*/jsx("div", {
className: "card-layout-content",
style: props.contentStyle,
children: props.children
}) : null]
});
};
CardLayout.defaultProps = {
titleLeftLine: true,
layoutType: 'layer'
};
export { CardLayout as C };
//# sourceMappingURL=card-layout-BNs6jF2K.js.map