|
|
@@ -17,13 +17,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
|
*/
|
|
|
|
|
|
-import { Toast } from '@douyinfe/semi-ui';
|
|
|
+import { Toast, Pagination } from '@douyinfe/semi-ui';
|
|
|
import { toastConstants } from '../constants';
|
|
|
import React from 'react';
|
|
|
import { toast } from 'react-toastify';
|
|
|
import { THINK_TAG_REGEX, MESSAGE_ROLES } from '../constants/playground.constants';
|
|
|
import { TABLE_COMPACT_MODES_KEY } from '../constants';
|
|
|
import { MOBILE_BREAKPOINT } from '../hooks/common/useIsMobile.js';
|
|
|
+import { useIsMobile } from '../hooks/common/useIsMobile.js';
|
|
|
|
|
|
const HTMLToastContent = ({ htmlContent }) => {
|
|
|
return <div dangerouslySetInnerHTML={{ __html: htmlContent }} />;
|
|
|
@@ -567,3 +568,35 @@ export const modelSelectFilter = (input, option) => {
|
|
|
const val = (option?.value || '').toString().toLowerCase();
|
|
|
return val.includes(input.trim().toLowerCase());
|
|
|
};
|
|
|
+
|
|
|
+// -------------------------------
|
|
|
+// CardPro 分页配置组件
|
|
|
+// 用于创建 CardPro 的 paginationArea 配置
|
|
|
+export const createCardProPagination = ({
|
|
|
+ currentPage,
|
|
|
+ pageSize,
|
|
|
+ total,
|
|
|
+ onPageChange,
|
|
|
+ onPageSizeChange,
|
|
|
+ pageSizeOpts = [10, 20, 50, 100],
|
|
|
+ showSizeChanger = true,
|
|
|
+}) => {
|
|
|
+ const isMobile = useIsMobile();
|
|
|
+
|
|
|
+ if (!total || total <= 0) return null;
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Pagination
|
|
|
+ currentPage={currentPage}
|
|
|
+ pageSize={pageSize}
|
|
|
+ total={total}
|
|
|
+ pageSizeOpts={pageSizeOpts}
|
|
|
+ showSizeChanger={showSizeChanger}
|
|
|
+ onPageSizeChange={onPageSizeChange}
|
|
|
+ onPageChange={onPageChange}
|
|
|
+ size={isMobile ? "small" : "default"}
|
|
|
+ showQuickJumper={isMobile}
|
|
|
+ showTotal
|
|
|
+ />
|
|
|
+ );
|
|
|
+};
|