fix(client): [#398] [#399] reset page number to first page

This commit is contained in:
chenos 2022-05-20 12:16:46 +08:00
parent 07b9ac0873
commit c95889aec2
5 changed files with 9 additions and 8 deletions

View File

@ -76,6 +76,7 @@ export const Action: ComposedAction = observer((props: any) => {
className,
disabled,
icon,
title,
...others
} = props;
const { onClick } = useProps(props);
@ -113,7 +114,7 @@ export const Action: ComposedAction = observer((props: any) => {
component={component || Button}
className={classnames(className, actionDesignerCss)}
>
{compile(fieldSchema.title)}
{title || compile(fieldSchema.title)}
<Designer {...designerProps} />
</SortableItem>
);

View File

@ -83,7 +83,7 @@ export const FilterAction = observer((props: any) => {
</form>
}
>
<Action {...others} />
<Action {...others} title={field.title} />
</Popover>
</FilterActionContext.Provider>
);

View File

@ -103,7 +103,7 @@ export const useFilterActionProps = () => {
const defaultFilter = removeNullCondition(props.params.filter);
// filter parameter for the filter action
const filter = removeNullCondition(values?.filter);
service.run({ ...service.params?.[0], filter: mergeFilter(defaultFilter, filter) });
service.run({ ...service.params?.[0], page: 1, filter: mergeFilter(defaultFilter, filter) });
const items = filter?.$and || filter?.$or;
if (items?.length) {
field.title = t('{{count}} filter items', { count: items?.length || 0 });
@ -113,7 +113,7 @@ export const useFilterActionProps = () => {
},
onReset() {
const filter = removeNullCondition(props.params.filter);
service.run({ ...service.params?.[0], filter });
service.run({ ...service.params?.[0], filter, page: 1 });
field.title = t('Filter');
},
};

View File

@ -72,7 +72,7 @@ export const TableBlockDesigner = () => {
params.filter = filter;
field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['params'] = params;
service.run({ ...service.params?.[0], filter });
service.run({ ...service.params?.[0], filter, page: 1 });
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],
@ -190,7 +190,7 @@ export const TableBlockDesigner = () => {
params.pageSize = pageSize;
field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['params'] = params;
service.run({ ...service.params?.[0], pageSize });
service.run({ ...service.params?.[0], pageSize, page: 1 });
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],

View File

@ -57,7 +57,7 @@ export const TableSelectorDesigner = () => {
params.filter = filter;
field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['params'] = params;
service.run({ ...service.params?.[0], filter });
service.run({ ...service.params?.[0], filter, page: 1 });
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],
@ -175,7 +175,7 @@ export const TableSelectorDesigner = () => {
params.pageSize = pageSize;
field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['params'] = params;
service.run({ ...service.params?.[0], pageSize });
service.run({ ...service.params?.[0], pageSize, page: 1 });
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],