mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 03:25:57 +00:00
feat: change all pageSize options to 5/10/20/50/100/200 (#5020)
Some checks are pending
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
deploy client docs / Build (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
Some checks are pending
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
deploy client docs / Build (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
* fix: change all pageSize options to 5/10/20/50/100/200 * fix: reset pageSize options same as list options 5/10/20/50/100/200 * fix: reset table pageSize options same as list options 5/10/20/50/100/200 * fix: list set pageSizeOption as 5/10/20/50/100/200,showSizeChanger * fix: gridcard set pageSizeOption but showSizeChanger not set
This commit is contained in:
parent
07ed06b10e
commit
efac16c6a9
@ -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);
|
||||||
|
@ -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 },
|
||||||
|
@ -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 },
|
||||||
|
@ -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 {
|
||||||
|
@ -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);
|
||||||
|
@ -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}
|
||||||
|
@ -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,
|
||||||
|
@ -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 },
|
||||||
|
@ -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 },
|
||||||
|
@ -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 },
|
||||||
|
@ -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) {
|
||||||
|
@ -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 },
|
||||||
|
Loading…
Reference in New Issue
Block a user