const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_index = require("../../locales/index.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
require("./PisellShellFrame.less");
//#region src/components/pisellShellFrame/PisellShellFrame.tsx
const defaultConfig = {
	showTitle: false,
	showToolbar: false,
	showStatistic: false,
	statisticCollapsible: false,
	scroll: false,
	showBatchActionBar: false,
	showStatusArea: false
};
/**
* PisellShellFrame：通用壳层布局组件。
* 支持通过 config 控制各区域显隐，不同展示类型（表格/看板/日历/楼层图等）复用同一壳层。
*
* - 顶部：标题区（标题/副标题/辅助信息）、工具区（Toolbar）、统计区（Statistic List，可选折叠）
* - 中间：滚动承载（可选）+ Layout 插槽（children）
* - 底部：批量操作条（按选中状态出现）、状态提示区（加载/错误/同步提示等）
*/
const PisellShellFrame = (props) => {
	const { className, style, config: configProp, title, subtitle, titleExtra, toolbar, statisticList, children, batchActionBar, statusArea } = props;
	const config = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaultConfig), configProp);
	const [statisticCollapsed, setStatisticCollapsed] = (0, react.useState)(false);
	const hasTitle = config.showTitle && (title != null || subtitle != null || titleExtra != null);
	const hasToolbar = config.showToolbar && toolbar != null;
	const hasStatistic = config.showStatistic && statisticList != null;
	const hasBatchBar = config.showBatchActionBar && batchActionBar != null;
	const hasStatus = config.showStatusArea && statusArea != null;
	const scrollConfig = config.scroll;
	const useScroll = scrollConfig === true || typeof scrollConfig === "object" && scrollConfig != null;
	const scrollOpts = typeof scrollConfig === "object" && scrollConfig != null ? scrollConfig : null;
	const scrollStyle = scrollOpts === null || scrollOpts === void 0 ? void 0 : scrollOpts.style;
	const scrollClassName = scrollOpts === null || scrollOpts === void 0 ? void 0 : scrollOpts.className;
	return /* @__PURE__ */ react.default.createElement("div", {
		className: `pisell-shell-frame ${className !== null && className !== void 0 ? className : ""}`.trim(),
		style,
		"data-shell-frame": true
	}, /* @__PURE__ */ react.default.createElement("header", { className: "pisell-shell-frame-header" }, hasTitle && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-title" }, /* @__PURE__ */ react.default.createElement("span", null, title != null && /* @__PURE__ */ react.default.createElement("span", { className: "pisell-shell-frame-title-main" }, title), subtitle != null && /* @__PURE__ */ react.default.createElement("span", { className: "pisell-shell-frame-title-sub" }, subtitle)), titleExtra != null && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-title-extra" }, titleExtra)), hasToolbar && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-toolbar" }, toolbar), hasStatistic && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-statistic" }, config.statisticCollapsible ? /* @__PURE__ */ react.default.createElement(antd.Collapse, {
		ghost: true,
		activeKey: statisticCollapsed ? [] : ["statistic"],
		onChange: (keys) => setStatisticCollapsed(keys.length === 0),
		items: [{
			key: "statistic",
			label: /* @__PURE__ */ react.default.createElement("span", { className: "pisell-shell-frame-statistic-collapse-header" }, statisticCollapsed ? require_index.getText("shell-frame-statistic-expand") : require_index.getText("shell-frame-statistic-collapse")),
			children: statisticList
		}]
	}) : statisticList)), /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-body" }, useScroll ? /* @__PURE__ */ react.default.createElement("div", {
		className: `pisell-shell-frame-scroll ${scrollClassName !== null && scrollClassName !== void 0 ? scrollClassName : ""}`.trim(),
		style: scrollStyle
	}, children) : children), (hasBatchBar || hasStatus) && /* @__PURE__ */ react.default.createElement("footer", { className: "pisell-shell-frame-footer" }, hasBatchBar && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-batch-bar" }, batchActionBar), hasStatus && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-status" }, statusArea)));
};
PisellShellFrame.displayName = "PisellShellFrame";
//#endregion
exports.default = PisellShellFrame;
