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

* 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:
Zhichao Gu 2024-09-06 23:38:12 +08:00 committed by GitHub
parent 07ed06b10e
commit efac16c6a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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'),
value: field.decoratorProps?.params?.pageSize || 20,
options: [
{ label: '5', value: 5 },
{ label: '10', value: 10 },
{ label: '20', value: 20 },
{ label: '50', value: 50 },
{ label: '80', value: 80 },
{ label: '100', value: 100 },
{ label: '200', value: 200 },
],
onChange: (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'),
value: field.decoratorProps?.params?.pageSize || 20,
options: [
{ label: '5', value: 5 },
{ label: '10', value: 10 },
{ label: '20', value: 20 },
{ label: '50', value: 50 },

View File

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

View File

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

View File

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

View File

@ -51,6 +51,8 @@ const InternalList = (props) => {
[fieldSchema.properties, schemaMap],
);
const pageSizeOptions = [5, 10, 20, 50, 100, 200];
const onPaginationChange: PaginationProps['onChange'] = useCallback(
(page, pageSize) => {
run({
@ -97,6 +99,8 @@ const InternalList = (props) => {
total: meta?.count || 0,
pageSize: meta?.pageSize || 10,
current: meta?.page || 1,
showSizeChanger: true,
pageSizeOptions,
}
}
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 { t } = useTranslation();
const field: any = useField();
@ -279,12 +281,14 @@ const usePaginationProps = (pagination1, pagination2) => {
const result = useMemo(() => {
if (totalCount) {
return {
pageSizeOptions,
showTotal,
showSizeChanger: true,
...pagination,
};
} else {
return {
pageSizeOptions,
showTotal: false,
simple: true,
showTitle: false,

View File

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

View File

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

View File

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

View File

@ -26,6 +26,8 @@ type TableVoidProps = TableProps<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 => {
if (props.pagination === false) {
return false;
@ -41,6 +43,7 @@ const usePaginationProps = (props: TableProps<any> & { request?: any }, service)
pagination.pageSize = pageSize;
}
return {
pageSizeOptions,
showSizeChanger: true,
...pagination,
onChange(page, pageSize) {

View File

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