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

View File

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

View File

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

View File

@ -72,7 +72,7 @@ export const TableBlockDesigner = () => {
params.filter = filter; params.filter = filter;
field.decoratorProps.params = params; field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['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', { dn.emit('patch', {
schema: { schema: {
['x-uid']: fieldSchema['x-uid'], ['x-uid']: fieldSchema['x-uid'],
@ -190,7 +190,7 @@ export const TableBlockDesigner = () => {
params.pageSize = pageSize; params.pageSize = pageSize;
field.decoratorProps.params = params; field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['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', { dn.emit('patch', {
schema: { schema: {
['x-uid']: fieldSchema['x-uid'], ['x-uid']: fieldSchema['x-uid'],

View File

@ -57,7 +57,7 @@ export const TableSelectorDesigner = () => {
params.filter = filter; params.filter = filter;
field.decoratorProps.params = params; field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['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', { dn.emit('patch', {
schema: { schema: {
['x-uid']: fieldSchema['x-uid'], ['x-uid']: fieldSchema['x-uid'],
@ -175,7 +175,7 @@ export const TableSelectorDesigner = () => {
params.pageSize = pageSize; params.pageSize = pageSize;
field.decoratorProps.params = params; field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['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', { dn.emit('patch', {
schema: { schema: {
['x-uid']: fieldSchema['x-uid'], ['x-uid']: fieldSchema['x-uid'],