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");
const require_objectWithoutProperties = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_index$1 = require("../../../Pagination/index.js");
const require_withContainer = require("../../utils/withContainer.js");
let react = require("react");
react = require_runtime.__toESM(react);
//#region src/components/pisellDataSourceContainer/components/Pagination/index.tsx
const _excluded = ["serverActions", "refManager"];
const WithPagination = (0, react.forwardRef)((props) => {
	const { serverActions: { list: listAction }, refManager } = props, otherProps = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const { pagination, data } = listAction;
	/** 分页配置属性 */
	const paginationProps = (0, react.useMemo)(() => {
		return {
			showTotal: (total) => {
				return require_index.getText("table-pagination-total")((pagination === null || pagination === void 0 ? void 0 : pagination.pageNumber) || 1, Math.ceil(total / ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10)));
			},
			total: (data === null || data === void 0 ? void 0 : data.count) || 0,
			current: (pagination === null || pagination === void 0 ? void 0 : pagination.pageNumber) || 1,
			pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10,
			onChange: listAction.onPageChange
		};
	}, [
		pagination === null || pagination === void 0 ? void 0 : pagination.pageNumber,
		pagination === null || pagination === void 0 ? void 0 : pagination.pageSize,
		data === null || data === void 0 ? void 0 : data.count,
		listAction.onPageChange
	]);
	if (!pagination) {
		console.error("分页功能未启用");
		return null;
	}
	return /* @__PURE__ */ react.default.createElement(require_index$1.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, otherProps), paginationProps));
});
var Pagination_default = require_withContainer.default(WithPagination, "pagination");
//#endregion
exports.default = Pagination_default;
