feat: optimise modal and pagination

This commit is contained in:
xzdry 2022-04-25 13:17:55 +08:00
parent a49e7d0d53
commit d37986a19d
5 changed files with 17 additions and 4 deletions

View File

@ -18,7 +18,8 @@ const exampleProperties: Static<typeof ModalPropsSpec> = {
closable: true,
maskClosable: true,
confirmLoading: false,
defaultOpen:true
defaultOpen: true,
unmountOnExit: true,
};
export const Modal = implementRuntimeComponent({
version: 'arco/v1',
@ -89,7 +90,6 @@ export const Modal = implementRuntimeComponent({
footer={slotsElements.footer}
className={css(customStyle?.content)}
mountOnEnter={true}
unmountOnExit={true}
{...cProps}
>
<div ref={contentRef}>{slotsElements.content}</div>

View File

@ -4,7 +4,7 @@ import { css, cx } from '@emotion/css';
import { Type, Static } from '@sinclair/typebox';
import { FALLBACK_METADATA, getComponentProps } from '../sunmao-helper';
import { PaginationPropsSpec as BasePaginationPropsSpec } from '../generated/types/Pagination';
import { useState } from 'react';
import { useEffect, useState } from 'react';
const PaginationPropsSpec = Type.Object(BasePaginationPropsSpec);
const PaginationStateSpec = Type.Object({
@ -21,6 +21,7 @@ const exampleProperties: Static<typeof PaginationPropsSpec> = {
sizeCanChange: false,
simple: false,
showJumper: false,
showTotal: false,
};
const options = {
@ -54,6 +55,10 @@ export const Pagination = implementRuntimeComponent(options)(props => {
Reflect.deleteProperty(cProps, 'pageSize');
}
useEffect(() => {
mergeState({ currentPage: current });
}, []);
const handleChange = (pageNum: number) => {
setCurrent(pageNum);
mergeState({ currentPage: current });

View File

@ -29,7 +29,7 @@ export const DropdownPropsSpec = {
}),
unmountOnExit:Type.Boolean({
title:'Unmount On Exit',
category: Category.Basic
category: Category.Behavior
}),
list: Type.Array(
Type.Object({

View File

@ -42,4 +42,8 @@ export const ModalPropsSpec = {
title: 'Confirm Loading',
category: Category.Basic,
}),
unmountOnExit:Type.Boolean({
title:'Unmount On Exit',
category: Category.Behavior
}),
};

View File

@ -40,4 +40,8 @@ export const PaginationPropsSpec = {
category: Category.Basic,
description: 'Whether to display quick jump',
}),
showTotal: Type.Boolean({
title: 'Show Total',
category: Category.Basic,
}),
};