Merge branch 'main' into next
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run

This commit is contained in:
GitHub Actions Bot 2024-09-06 16:06:28 +00:00
commit 1dc108a4a2
12 changed files with 22 additions and 2 deletions

View File

@ -187,11 +187,12 @@ export const listBlockSettings = new SchemaSettings({
title: t('Records per page'), title: t('Records per page'),
value: field.decoratorProps?.params?.pageSize || 20, value: field.decoratorProps?.params?.pageSize || 20,
options: [ options: [
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },
{ label: '80', value: 80 },
{ label: '100', value: 100 }, { label: '100', value: 100 },
{ label: '200', value: 200 },
], ],
onChange: (pageSize) => { onChange: (pageSize) => {
_.set(fieldSchema, 'x-decorator-props.params.pageSize', pageSize); _.set(fieldSchema, 'x-decorator-props.params.pageSize', pageSize);

View File

@ -251,6 +251,7 @@ export const tableSelectorBlockSettings = new SchemaSettings({
title: t('Records per page'), title: t('Records per page'),
value: field.decoratorProps?.params?.pageSize || 20, value: field.decoratorProps?.params?.pageSize || 20,
options: [ options: [
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },

View File

@ -164,6 +164,7 @@ export const tableBlockSettings = new SchemaSettings({
title: t('Records per page'), title: t('Records per page'),
value: field.decoratorProps?.params?.pageSize || 20, value: field.decoratorProps?.params?.pageSize || 20,
options: [ options: [
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },

View File

@ -89,6 +89,7 @@ const usePaginationProps = () => {
pageSize: pageSize || 10, pageSize: pageSize || 10,
current: page || 1, current: page || 1,
pageSizeOptions, pageSizeOptions,
showSizeChanger: true,
}; };
} else { } else {
return { return {

View File

@ -170,11 +170,12 @@ export const ListDesigner = () => {
title={t('Records per page')} title={t('Records per page')}
value={field.decoratorProps?.params?.pageSize || 20} value={field.decoratorProps?.params?.pageSize || 20}
options={[ options={[
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },
{ label: '80', value: 80 },
{ label: '100', value: 100 }, { label: '100', value: 100 },
{ label: '200', value: 200 },
]} ]}
onChange={(pageSize) => { onChange={(pageSize) => {
_.set(fieldSchema, 'x-decorator-props.params.pageSize', pageSize); _.set(fieldSchema, 'x-decorator-props.params.pageSize', pageSize);

View File

@ -51,6 +51,8 @@ const InternalList = (props) => {
[fieldSchema.properties, schemaMap], [fieldSchema.properties, schemaMap],
); );
const pageSizeOptions = [5, 10, 20, 50, 100, 200];
const onPaginationChange: PaginationProps['onChange'] = useCallback( const onPaginationChange: PaginationProps['onChange'] = useCallback(
(page, pageSize) => { (page, pageSize) => {
run({ run({
@ -97,6 +99,8 @@ const InternalList = (props) => {
total: meta?.count || 0, total: meta?.count || 0,
pageSize: meta?.pageSize || 10, pageSize: meta?.pageSize || 10,
current: meta?.page || 1, current: meta?.page || 1,
showSizeChanger: true,
pageSizeOptions,
} }
} }
loading={service?.loading} loading={service?.loading}

View File

@ -261,6 +261,8 @@ const TableIndex = (props) => {
); );
}; };
const pageSizeOptions = [5, 10, 20, 50, 100, 200];
const usePaginationProps = (pagination1, pagination2) => { const usePaginationProps = (pagination1, pagination2) => {
const { t } = useTranslation(); const { t } = useTranslation();
const field: any = useField(); const field: any = useField();
@ -279,12 +281,14 @@ const usePaginationProps = (pagination1, pagination2) => {
const result = useMemo(() => { const result = useMemo(() => {
if (totalCount) { if (totalCount) {
return { return {
pageSizeOptions,
showTotal, showTotal,
showSizeChanger: true, showSizeChanger: true,
...pagination, ...pagination,
}; };
} else { } else {
return { return {
pageSizeOptions,
showTotal: false, showTotal: false,
simple: true, simple: true,
showTitle: false, showTitle: false,

View File

@ -282,6 +282,7 @@ export const TableBlockDesigner = () => {
title={t('Records per page')} title={t('Records per page')}
value={field.decoratorProps?.params?.pageSize || 20} value={field.decoratorProps?.params?.pageSize || 20}
options={[ options={[
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },

View File

@ -237,6 +237,7 @@ export const TableSelectorDesigner = () => {
title={t('Records per page')} title={t('Records per page')}
value={field.decoratorProps?.params?.pageSize || 20} value={field.decoratorProps?.params?.pageSize || 20}
options={[ options={[
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },

View File

@ -194,6 +194,7 @@ export const TableVoidDesigner = () => {
title={'每页显示'} title={'每页显示'}
value={field.decoratorProps.request.params?.pageSize || 20} value={field.decoratorProps.request.params?.pageSize || 20}
options={[ options={[
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },

View File

@ -26,6 +26,8 @@ type TableVoidProps = TableProps<any> & {
) => Result<any, any> & { state?: any; setState?: any }; ) => Result<any, any> & { state?: any; setState?: any };
}; };
const pageSizeOptions = [5, 10, 20, 50, 100, 200];
const usePaginationProps = (props: TableProps<any> & { request?: any }, service): TablePaginationConfig | false => { const usePaginationProps = (props: TableProps<any> & { request?: any }, service): TablePaginationConfig | false => {
if (props.pagination === false) { if (props.pagination === false) {
return false; return false;
@ -41,6 +43,7 @@ const usePaginationProps = (props: TableProps<any> & { request?: any }, service)
pagination.pageSize = pageSize; pagination.pageSize = pageSize;
} }
return { return {
pageSizeOptions,
showSizeChanger: true, showSizeChanger: true,
...pagination, ...pagination,
onChange(page, pageSize) { onChange(page, pageSize) {

View File

@ -54,6 +54,7 @@ export const AuditLogsDesigner = () => {
title={t('Records per page')} title={t('Records per page')}
value={field.decoratorProps?.params?.pageSize || 20} value={field.decoratorProps?.params?.pageSize || 20}
options={[ options={[
{ label: '5', value: 5 },
{ label: '10', value: 10 }, { label: '10', value: 10 },
{ label: '20', value: 20 }, { label: '20', value: 20 },
{ label: '50', value: 50 }, { label: '50', value: 50 },