@flatbiz/antd
Version:
89 lines (85 loc) • 3.01 kB
JavaScript
/*! @flatjs/forge MIT @flatbiz/antd */
import { isArray } from '@dimjs/lang/is-array';
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 { fbaHooks } from './fba-hooks/index.js';
import { jsx, jsxs } from 'react/jsx-runtime';
/**
* 简单布局
* @deprecated 已过期,使用 CardLayout 组件替代
* ```
* 1. layoutType 布局类型
* layer:分层布局
* tight:紧凑布局(没有外边距)
* ```
*/
var SimpleLayout = function SimpleLayout(props) {
var labelAlign = props.formLabelAlign || 'right';
var className = classNames('simple-layout', {
'simple-layout-tight': props.layoutType === 'tight',
'simple-layout-formlabel-left': labelAlign === 'left',
'simple-layout-title-fixed': props.titleFixed,
'simple-layout-small': props.size === 'small'
}, props.className);
var theme = fbaHooks.useThemeToken();
var style = extend({
'--simple-layout-colorPrimary': theme.colorPrimary
}, props.style, {
padding: props.padding,
width: props.width
});
if (props.hidden) return /*#__PURE__*/jsx(Fragment, {});
return /*#__PURE__*/jsxs("div", {
className: className,
style: style,
onClick: props.onClick,
children: [props.title && props.titleExtra ? /*#__PURE__*/jsx("div", {
className: classNames({
'simple-layout-title-sign': props.titleLeftLine
}),
style: props.titleStyle,
children: /*#__PURE__*/jsxs(Space, {
className: "simple-layout-title-extra-space",
children: [/*#__PURE__*/jsx("div", {
className: "simple-layout-title",
children: props.title
}), /*#__PURE__*/jsx("div", {
className: "simple-layout-title-extra",
children: props.titleExtra
})]
})
}) : null, props.title && !props.titleExtra ? /*#__PURE__*/jsx("div", {
className: classNames('simple-layout-title', {
'simple-layout-title-sign': props.titleLeftLine
}),
style: props.titleStyle,
children: props.title
}) : null, props.desc && !isArray(props.desc) ? /*#__PURE__*/jsx("div", {
className: "simple-layout-desc",
children: props.desc
}) : null, props.desc && isArray(props.desc) ? /*#__PURE__*/jsx("div", {
className: "simple-layout-desc",
children: /*#__PURE__*/jsx(Space, {
direction: "vertical",
size: 5,
children: props.desc.map(function (item, index) {
return /*#__PURE__*/jsx(Fragment, {
children: item
}, index);
})
})
}) : null, props.children ? /*#__PURE__*/jsx("div", {
className: "simple-layout-content",
style: props.contentStyle,
children: props.children
}) : null]
});
};
SimpleLayout.defaultProps = {
titleLeftLine: true,
layoutType: 'layer'
};
export { SimpleLayout as S };
//# sourceMappingURL=simple-layout-mSolkIZ5.js.map